diff --git a/application/Controllers/Account/Edit.php b/application/Controllers/Account/Edit.php new file mode 100644 index 0000000..6328e48 --- /dev/null +++ b/application/Controllers/Account/Edit.php @@ -0,0 +1,88 @@ +config = new AauthConfig(); + $this->aauth = new Aauth(); + $this->request = Services::request(); + helper('form'); + helper('aauth'); + } + + /** + * Index + * + * @return void + */ + public function index() + { + $userId = $this->aauth->getUserId(); + + if ($input = $this->request->getPost()) + { + $email = $password = $username = null; + + if (! empty($input['email'])) + { + $email = $input['email']; + } + + if (! empty($input['password'])) + { + $password = $input['password']; + } + + if (! empty($input['username'])) + { + $username = $input['username']; + } + + if (! $this->aauth->updateUser($userId, $email, $password, $username)) + { + $data['errors'] = $this->aauth->printErrors('
', true); + } + else + { + $data['infos'] = $this->aauth->printInfos('
', true); + } + } + + $data['useUsername'] = $this->config->loginUseUsername; + + echo view('Templates/Header', $data); + echo view('Account/Edit', $data); + echo view('Templates/Footer', $data); + } +} diff --git a/application/Controllers/Account/Home.php b/application/Controllers/Account/Home.php index 0162975..37ffa22 100644 --- a/application/Controllers/Account/Home.php +++ b/application/Controllers/Account/Home.php @@ -18,7 +18,6 @@ namespace App\Controllers\Account; use CodeIgniter\Controller; -use Config\Aauth as AauthConfig; use App\Libraries\Aauth; use App\Models\Aauth\UserModel; @@ -34,9 +33,8 @@ class Home extends Controller */ public function __construct() { - $this->config = new AauthConfig(); - $this->user = new UserModel(); - $this->aauth = new Aauth(); + $this->aauth = new Aauth(); + helper('aauth'); if (! $this->aauth->isLoggedIn()) { @@ -51,12 +49,10 @@ class Home extends Controller */ public function index() { - // print_r($this->aauth->session); - // print_r($this->aauth->login("admin@example.com", "password123456")); - // print_r($this->aauth->deleteUser(4)); - // print_r($this->aauth->updateUser(1, "admin@example.com", "password", 'Admines')); - // print_r($this->aauth->createUser("admin@example.coma", 'asdasasdasdsd')); + $data['user'] = $this->aauth->getUser(); - echo $this->aauth->printErrors('
', true); + echo view('Templates/Header'); + echo view('Account/Home', $data); + echo view('Templates/Footer'); } } diff --git a/application/Controllers/Account/Logout.php b/application/Controllers/Account/Logout.php index b983bca..ba95352 100644 --- a/application/Controllers/Account/Logout.php +++ b/application/Controllers/Account/Logout.php @@ -18,9 +18,7 @@ namespace App\Controllers\Account; use CodeIgniter\Controller; -use Config\Aauth as AauthConfig; use App\Libraries\Aauth; -use Config\Services; /** * Aauth Accont/Logout Controller @@ -34,9 +32,7 @@ class Logout extends Controller */ public function __construct() { - $this->config = new AauthConfig(); - $this->aauth = new Aauth(); - $this->request = Services::request(); + $this->aauth = new Aauth(); helper('form'); } diff --git a/application/Controllers/Account/Register.php b/application/Controllers/Account/Register.php index 831e771..05eb2e2 100644 --- a/application/Controllers/Account/Register.php +++ b/application/Controllers/Account/Register.php @@ -20,7 +20,6 @@ namespace App\Controllers\Account; use CodeIgniter\Controller; use Config\Aauth as AauthConfig; use App\Libraries\Aauth; -use App\Models\Aauth\UserVariableModel as UserVariableModel; use Config\Services; /** diff --git a/application/Controllers/Account/Remind_password.php b/application/Controllers/Account/Remind_password.php index 2795ce1..cf1ddc7 100644 --- a/application/Controllers/Account/Remind_password.php +++ b/application/Controllers/Account/Remind_password.php @@ -18,9 +18,7 @@ namespace App\Controllers\Account; use CodeIgniter\Controller; -use Config\Aauth as AauthConfig; use App\Libraries\Aauth; -use App\Models\Aauth\UserVariableModel as UserVariableModel; use Config\Services; /** @@ -35,7 +33,6 @@ class Remind_password extends Controller */ public function __construct() { - $this->config = new AauthConfig(); $this->aauth = new Aauth(); $this->request = Services::request(); helper('form'); diff --git a/application/Controllers/Account/Reset_password.php b/application/Controllers/Account/Reset_password.php index aa6e4ce..4f2d60d 100644 --- a/application/Controllers/Account/Reset_password.php +++ b/application/Controllers/Account/Reset_password.php @@ -18,9 +18,7 @@ namespace App\Controllers\Account; use CodeIgniter\Controller; -use Config\Aauth as AauthConfig; use App\Libraries\Aauth; -use App\Models\Aauth\UserVariableModel as UserVariableModel; use Config\Services; /** @@ -35,7 +33,6 @@ class Reset_password extends Controller */ public function __construct() { - $this->config = new AauthConfig(); $this->aauth = new Aauth(); $this->request = Services::request(); helper('form'); diff --git a/application/Controllers/Account/Verification.php b/application/Controllers/Account/Verification.php index 995c1e8..40935c3 100644 --- a/application/Controllers/Account/Verification.php +++ b/application/Controllers/Account/Verification.php @@ -18,7 +18,6 @@ namespace App\Controllers\Account; use CodeIgniter\Controller; -use Config\Aauth as AauthConfig; use App\Libraries\Aauth; use Config\Services; @@ -34,7 +33,6 @@ class Verification extends Controller */ public function __construct() { - $this->config = new AauthConfig(); $this->aauth = new Aauth(); $this->request = Services::request(); helper('form'); diff --git a/application/Language/de/Aauth.php b/application/Language/de/Aauth.php index 492c7ae..e01efbf 100644 --- a/application/Language/de/Aauth.php +++ b/application/Language/de/Aauth.php @@ -35,6 +35,7 @@ return [ 'infoCreateSuccess' => 'Dein Benutzerkonto wurde erfolgreich erstellt, du kannst dich jetzt einloggen.', 'infoCreateVerification' => 'Dein Benutzerkonto wurde erfolgreich erstellt. Eine E-Mail mit Informationen zur Bestätigung wurde an deine E-Mail-Adresse versendet. ', + 'infoUpdateSuccess' => 'Dein Benutzerkonto wurde erfolgreich geändert.', 'infoRemindSuccess' => 'Eine E-Mail mit Informationen zum zurückzusetzen wurde an deine E-Mail-Adresse versendet.', 'infoResetSuccess' => 'Eine E-Mail mit deinem neuem Passwort wurde an deine E-Mail-Adresse versendet.', 'infoVerification' => 'Dein Benutzerkonto wurde erfolgreich bestätigt, du kannst dich jetzt einloggen.', diff --git a/application/Language/en/Aauth.php b/application/Language/en/Aauth.php index 927a596..c235ffb 100644 --- a/application/Language/en/Aauth.php +++ b/application/Language/en/Aauth.php @@ -35,6 +35,7 @@ return [ 'infoCreateSuccess' => 'Your account has successfully been created. You can now login.', 'infoCreateVerification' => 'Your account has successfully been created. A email has been sent to your email address with verification details..', + 'infoUpdateSuccess' => 'Your account has successfully updated.', 'infoRemindSuccess' => 'A email has been sent to your email address with reset instructions.', 'infoResetSuccess' => 'A email has been sent to your email address with your new password has been sent.', 'infoVerification' => 'Your account has been verified successfully, you can now login.', diff --git a/application/Language/en/Account.php b/application/Language/en/Account.php index 347e8cf..a47bf98 100644 --- a/application/Language/en/Account.php +++ b/application/Language/en/Account.php @@ -25,6 +25,16 @@ * @codeCoverageIgnore */ return [ + 'homeText' => 'Account Details', + 'homeLabelUsername' => 'Username', + 'homeLabelEmail' => 'Email address', + + 'editHeader' => 'Edit Profile', + 'editLabelUsername' => 'Username', + 'editLabelEmail' => 'Email address', + 'editLabelPassword' => 'Password', + 'editLabelSubmit' => 'Save changes', + 'linkBackToLogin' => 'Back to Login', 'linkLogin' => 'Login', 'linkRegister' => 'Register new Account', diff --git a/application/Language/es/Aauth.php b/application/Language/es/Aauth.php index 99e4beb..b49cd9f 100644 --- a/application/Language/es/Aauth.php +++ b/application/Language/es/Aauth.php @@ -35,6 +35,7 @@ return [ 'infoCreateSuccess' => 'Your account has successfully been created. You can now login.', 'infoCreateVerification' => 'Your account has successfully been created. A email has been sent to your email address with verification details..', + 'infoUpdateSuccess' => 'Your account has successfully updated.', 'infoRemindSuccess' => 'A email has been sent to your email address with reset instructions.', 'infoResetSuccess' => 'A email has been sent to your email address with your new password has been sent.', 'infoVerification' => 'Your account has been verified successfully, you can now login.', diff --git a/application/Language/fa/Aauth.php b/application/Language/fa/Aauth.php index 7e48862..cea0daf 100644 --- a/application/Language/fa/Aauth.php +++ b/application/Language/fa/Aauth.php @@ -35,6 +35,7 @@ return [ 'infoCreateSuccess' => 'Your account has successfully been created. You can now login.', 'infoCreateVerification' => 'Your account has successfully been created. A email has been sent to your email address with verification details..', + 'infoUpdateSuccess' => 'Your account has successfully updated.', 'infoRemindSuccess' => 'A email has been sent to your email address with reset instructions.', 'infoResetSuccess' => 'A email has been sent to your email address with your new password has been sent.', 'infoVerification' => 'Your account has been verified successfully, you can now login.', diff --git a/application/Language/fr/Aauth.php b/application/Language/fr/Aauth.php index 73354a4..eb18945 100644 --- a/application/Language/fr/Aauth.php +++ b/application/Language/fr/Aauth.php @@ -35,6 +35,7 @@ return [ 'infoCreateSuccess' => 'Your account has successfully been created. You can now login.', 'infoCreateVerification' => 'Your account has successfully been created. A email has been sent to your email address with verification details..', + 'infoUpdateSuccess' => 'Your account has successfully updated.', 'infoRemindSuccess' => 'A email has been sent to your email address with reset instructions.', 'infoResetSuccess' => 'A email has been sent to your email address with your new password has been sent.', 'infoVerification' => 'Your account has been verified successfully, you can now login.', diff --git a/application/Language/id/Aauth.php b/application/Language/id/Aauth.php index 0a6d77a..1840d39 100644 --- a/application/Language/id/Aauth.php +++ b/application/Language/id/Aauth.php @@ -35,6 +35,7 @@ return [ 'infoCreateSuccess' => 'Your account has successfully been created. You can now login.', 'infoCreateVerification' => 'Your account has successfully been created. A email has been sent to your email address with verification details..', + 'infoUpdateSuccess' => 'Your account has successfully updated.', 'infoRemindSuccess' => 'A email has been sent to your email address with reset instructions.', 'infoResetSuccess' => 'A email has been sent to your email address with your new password has been sent.', 'infoVerification' => 'Your account has been verified successfully, you can now login.', diff --git a/application/Language/ru/Aauth.php b/application/Language/ru/Aauth.php index 2e7a32e..d53cbc0 100644 --- a/application/Language/ru/Aauth.php +++ b/application/Language/ru/Aauth.php @@ -35,6 +35,7 @@ return [ 'infoCreateSuccess' => 'Your account has successfully been created. You can now login.', 'infoCreateVerification' => 'Your account has successfully been created. A email has been sent to your email address with verification details..', + 'infoUpdateSuccess' => 'Your account has successfully updated.', 'infoRemindSuccess' => 'A email has been sent to your email address with reset instructions.', 'infoResetSuccess' => 'A email has been sent to your email address with your new password has been sent.', 'infoVerification' => 'Your account has been verified successfully, you can now login.', diff --git a/application/Language/sv/Aauth.php b/application/Language/sv/Aauth.php index dee6d3c..c3356a7 100644 --- a/application/Language/sv/Aauth.php +++ b/application/Language/sv/Aauth.php @@ -35,6 +35,7 @@ return [ 'infoCreateSuccess' => 'Your account has successfully been created. You can now login.', 'infoCreateVerification' => 'Your account has successfully been created. A email has been sent to your email address with verification details..', + 'infoUpdateSuccess' => 'Your account has successfully updated.', 'infoRemindSuccess' => 'A email has been sent to your email address with reset instructions.', 'infoResetSuccess' => 'A email has been sent to your email address with your new password has been sent.', 'infoVerification' => 'Your account has been verified successfully, you can now login.', diff --git a/application/Language/zh-CN/Aauth.php b/application/Language/zh-CN/Aauth.php index 55e5a09..217b519 100644 --- a/application/Language/zh-CN/Aauth.php +++ b/application/Language/zh-CN/Aauth.php @@ -37,6 +37,7 @@ return [ 'infoCreateSuccess' => 'Your account has successfully been created. You can now login.', 'infoCreateVerification' => 'Your account has successfully been created. A email has been sent to your email address with verification details..', + 'infoUpdateSuccess' => 'Your account has successfully updated.', 'infoRemindSuccess' => 'A email has been sent to your email address with reset instructions.', 'infoResetSuccess' => 'A email has been sent to your email address with your new password has been sent.', 'infoVerification' => 'Your account has been verified successfully, you can now login.', diff --git a/application/Language/zh-TW/Aauth.php b/application/Language/zh-TW/Aauth.php index 32b5422..438d578 100644 --- a/application/Language/zh-TW/Aauth.php +++ b/application/Language/zh-TW/Aauth.php @@ -37,6 +37,7 @@ return [ 'infoCreateSuccess' => 'Your account has successfully been created. You can now login.', 'infoCreateVerification' => 'Your account has successfully been created. A email has been sent to your email address with verification details..', + 'infoUpdateSuccess' => 'Your account has successfully updated.', 'infoRemindSuccess' => 'A email has been sent to your email address with reset instructions.', 'infoResetSuccess' => 'A email has been sent to your email address with your new password has been sent.', 'infoVerification' => 'Your account has been verified successfully, you can now login.', diff --git a/application/Libraries/Aauth.php b/application/Libraries/Aauth.php index d9c8a2b..9f5f437 100644 --- a/application/Libraries/Aauth.php +++ b/application/Libraries/Aauth.php @@ -169,7 +169,7 @@ class Aauth return false; } - else if (! is_null($email) && ! is_null($password) && ! is_null($username)) + else if (is_null($email) && is_null($password) && is_null($username)) { return false; } @@ -193,6 +193,8 @@ class Aauth if ($userModel->update($userId, $data)) { + $this->info(lang('Aauth.infoUpdateSuccess')); + return true; } @@ -378,7 +380,7 @@ class Aauth if ($user = $userModel->where($where)->first()) { - return $user->id; + return $user['id']; } return false; diff --git a/application/Views/Account/Edit.php b/application/Views/Account/Edit.php new file mode 100644 index 0000000..fecc661 --- /dev/null +++ b/application/Views/Account/Edit.php @@ -0,0 +1,32 @@ +
+
+
+
+ +
+ + +
+ +
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ +
+
+
diff --git a/application/Views/Account/Home.php b/application/Views/Account/Home.php new file mode 100644 index 0000000..262040c --- /dev/null +++ b/application/Views/Account/Home.php @@ -0,0 +1,3 @@ +


+:
+:
diff --git a/application/Views/Templates/Header.php b/application/Views/Templates/Header.php index 9ce9cd2..d06166c 100644 --- a/application/Views/Templates/Header.php +++ b/application/Views/Templates/Header.php @@ -18,7 +18,7 @@