first commit
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/System/ChpasswdController
|
||||
Description : Data Ubah Password
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : December 7th, 2008.
|
||||
Last Modified : August 9th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\System;
|
||||
|
||||
use flight\Engine;
|
||||
use flight\Session;
|
||||
use Webapp\App\Auth;
|
||||
use Webapp\Web\Form;
|
||||
use Webapp\Web\Param;
|
||||
|
||||
class ChpasswdController {
|
||||
|
||||
protected Engine $app;
|
||||
|
||||
public function __construct(Engine $app, Session $session) {
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
public function simpan() {
|
||||
$ajson['status'] = false;
|
||||
|
||||
$l_pass = Param::Get("LPass");
|
||||
$b_pass1 = Param::Get("BPass1");
|
||||
|
||||
$auth = new Auth($this->app);
|
||||
if ($auth->user_check($this->app->user()->username(), $l_pass)) {
|
||||
$this->app->db()->update('app_operator', 'Password=MD5(?) WHERE UserID=?', [$b_pass1, $this->app->user()->id()]);
|
||||
$ajson['status'] = true;
|
||||
$ajson['message'] = "Sukses merubah password Anda!";
|
||||
} else {
|
||||
$ajson['message'] = "Password lama Anda salah!";
|
||||
}
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$form = new Form($this->app);
|
||||
$t_passl = $form->password("_", "LPass", '', true, true, "masukkan password lama", 20);
|
||||
$t_passb1 = $form->password("_", "BPass1", '', true, true, "masukkan password baru 1", 20);
|
||||
$t_passb2 = $form->password("_", "BPass2", '', true, true, "masukkan password baru 2", 20);
|
||||
$ajson['html'] = '
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-6 col-lg-4 col-form-label" for="LPass">Password Lama</label>
|
||||
<div class="col">'.$t_passl.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-6 col-lg-4 col-form-label" for="BPass1">Password Baru 1</label>
|
||||
<div class="col">'.$t_passb1.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-6 col-lg-4 col-form-label" for="BPass2">Password Baru 2</label>
|
||||
<div class="col">'.$t_passb2.'</div>
|
||||
</div>';
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user