Welcome Guest, Not a member yet? Register   Sign In
Myth Auth strong_password
#5

(07-28-2022, 01:40 AM)manager Wrote:
(07-28-2022, 12:09 AM)superior Wrote: Controller has nothing to do with it because it's a rule set to validate;  strong_password.

Do not agree with you. Change password request goes from user to the controller, but Myth AuthController.php don't have appropriate method to process this request, so i guess you added this code and maybe some extra validation. So there is no harm to have a look at this part of code too to eliminate that there is no problem. And please give the exact error message, used username and email values.
Don't see how this would help because my Controller has nothing to do with it but ok...
The error message is translated from MythAuth on key 'errorPasswordPersonal', it's different by language.
See: https://github.com/lonnieezell/myth-auth...th.php#L49


PHP Code:
public function postPassword()
    {
        $setRules = [
            'current' => [
                'label' => lang('Auth.password'),
                'rules' => 'required',
            ],
            'newpasswd' => [
                'label' => lang('Auth.newPassword'),
                'rules' => 'required|strong_password'// As said before, it's only this part `strong_password`
            ],
            'reppasswd' => [
                'label' => lang('Auth.repeatPassword'),
                'rules' => 'required|matches[newpasswd]',
            ]
        ];

        if( !$this->validate($setRules) )
        {
            return redirect()->tourl_to('change_password') )->with('errors'$this->validator->getErrors());
        }
        else {

            $userModel modelUserModel::class );

            if( $user $userModel->where("id"user_id())->first() )
            {
                if (! $this->auth->attempt(['username' => $user->username'password' => $this->request->getPost('current')], false)) {
                    return redirect()->tourl_to('change_password') )->with('errors', ['current' => lang('Auth.invalidCurrentPassword')]);
                }

                $user->password $this->request->getPost('newpasswd');
                
                
if( !$userModel->save($user) ) {
                    return redirect()->tourl_to('change_password') )->with('errors'$userModel->errors());
                }

                return redirect()->tourl_to('change_password') )->with('message'lang('Auth.passwordChangeSuccess'));
            }
        }
    
Reply


Messages In This Thread
Myth Auth strong_password - by superior - 07-27-2022, 12:06 PM
RE: Myth Auth strong_password - by manager - 07-27-2022, 11:30 PM
RE: Myth Auth strong_password - by superior - 07-28-2022, 12:09 AM
RE: Myth Auth strong_password - by manager - 07-28-2022, 01:40 AM
RE: Myth Auth strong_password - by superior - 07-28-2022, 02:19 AM
RE: Myth Auth strong_password - by manager - 07-28-2022, 03:13 AM
RE: Myth Auth strong_password - by superior - 07-28-2022, 03:54 AM
RE: Myth Auth strong_password - by manager - 07-28-2022, 04:15 AM
RE: Myth Auth strong_password - by superior - 07-28-2022, 04:24 AM
RE: Myth Auth strong_password - by manager - 07-28-2022, 04:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB