Your IP : 216.73.216.79


Current Path : /var/www/html/ssr26/frontend/runtime/frontendpage/
Upload File :
Current File : /var/www/html/ssr26/frontend/runtime/frontendpage/73_1774949174014126600-content-174.php

<?php 
/*** CONTENT_ID-174***/
use backend\modules\fruserdynav2\models\ChangePassword;
use yii\helpers\Html;
use yii\widgets\ActiveForm;

if (($model = ChangePassword::findOne(Yii::$app->user->identity->id)) !== null) {
    if ($model->load(Yii::$app->request->post())) {
        $model->updated_at = date("Y-m-d H:i:s");
        $model->updated_by = Yii::$app->user->identity->id;
        $model->updated_user_type = 'frontend_user';
        $model->password_hash = Yii::$app->security->generatePasswordHash($model->new_password);
        if ($model->save()) {
            
            echo "<script src='https://cdn.jsdelivr.net/npm/sweetalert2@11'></script>
            <script>
                Swal.fire({
                  icon: 'success',
                  title: 'Berjaya',
                  text: 'Kata laluan telah ditukar',
                }).then((result) => {
                  window.location.href = '".$baseUrl."/portal-main/change-password';
                });
            </script>";
            
            return;
        }
        
        ## reset the field or burp will flag this as vulnerable
        $model->new_password = null;
        $model->old_password = null;
        $model->repeat_password = null;
    }
}
    

$form = ActiveForm::begin();  

echo '
<style>
    .wrapper{background:white !important;}
    .user-wrapper{
        margin-top: -110px;
        border-radius: 5px;
        padding:30px;
        padding-top:0;
        padding-bottom: 50px;
        box-shadow: rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px;background: linear-gradient(9deg, rgba(243,243,243,1) 0%, rgba(240,240,240,1) 35%, rgba(243,243,243,1) 100%);
    }
</style>';

    echo '<div class="container mb-100 user-wrapper">
     
        <h3 class="pt-50 pb-30">Tukar Kata Laluan</h3>';

echo '<div id="wrapper_old_password" style="position:relative;">';
echo $form->field($model, 'old_password')->passwordInput(['maxlength' => true,'autocomplete'=>'new-password']);
echo '<span id="toggle_old_password" class="toggle-password" onclick="togglepassword(\'old_password\')"><i class="fa fa-eye-slash" aria-hidden="true"></i></span>';
echo '</div>';
                
echo '<div id="wrapper_new_password" style="position:relative;">';
echo $form->field($model, 'new_password')->passwordInput(['maxlength' => true,'autocomplete'=>'new-password']);
echo '<span id="toggle_new_password" class="toggle-password" onclick="togglepassword(\'new_password\')"><i class="fa fa-eye-slash" aria-hidden="true"></i></span>';
echo '</div>';

echo '<div id="wrapper_repeat_password" style="position:relative;">';
echo $form->field($model, 'repeat_password')->passwordInput(['maxlength' => true,'autocomplete'=>'new-password']);
echo '<span id="toggle_repeat_password" class="toggle-password"  onclick="togglepassword(\'repeat_password\')"><i class="fa fa-eye-slash" aria-hidden="true"></i></span>';
echo '</div>';
                
echo Html::a(Yii::t('app', 'Set Semula'), ['/portal-main/change-password'], ['class' => 'button']).'&nbsp;';
echo Html::submitButton(Yii::t('app', 'Hantar'), ['class' => 'button']);

echo '</div>';

ActiveForm::end();


echo "
<style>
    .toggle-password{
        cursor : pointer;
        position : absolute;
        right : 1em;
        top : 55%;
    }
</style>
<script>
    function togglepassword(passwordtype){
        event.preventDefault();
        if($('#wrapper_'+passwordtype+' input').attr('type') == 'text'){
            $('#wrapper_'+passwordtype+' input').attr('type', 'password');
            $('#wrapper_'+passwordtype+' i').addClass( 'fa-eye-slash' );
            $('#wrapper_'+passwordtype+' i').removeClass( 'fa-eye' );
        } else if($('#wrapper_'+passwordtype+' input').attr('type') == 'password'){
            $('#wrapper_'+passwordtype+' input').attr('type', 'text');
            $('#wrapper_'+passwordtype+' i').removeClass( 'fa-eye-slash' );
            $('#wrapper_'+passwordtype+' i').addClass( 'fa-eye' );
        }
        
    }
</script>";
?>