middleware(['front', 'auth']); $this->userModel = $user; } /** * 정기 비밀번호 변경 안내 * @method GET * @see /account/password/campaign */ public function index() { return view(layout('account.passwordCampaign'), [ 'changePasswordDay' => config('change_password_day', 0), 'menuID' => 'PASSWORD_CAMPAIGN' ]); } /** * 정기 비밀번호 변경 안내 * @method POST * @see /account/password/campaign */ public function update(Request $request) { $rules = [ 'password' => 'required|string', 'new_password' => [ 'required', 'string', 'confirmed', new NumberLength, new SpecialCharLength, new UppercaseLength ], ]; $attributes = [ 'password' => '현재 비밀번호', 'new_password' => '새 비밀번호', 'new_password_confirmation' => '새 비밀번호 확인' ]; $posts = $this->validate($request, $rules, [], $attributes); $certified = $this->passwordAuthed($posts['password']); if(!$certified) { return back()->withErrors('현재 비밀번호가 일치하지 않습니다.'); } // 동일 비밀번호 여부 확인 if ($posts['new_password'] == $posts['password']) { return back()->withErrors('이전 비밀번호는 사용할 수 없습니다.'); } $this->userModel->updater(UID, [ 'password' => $this->passwordMake($posts['new_password']), 'password_updated_at' => now() ]); return redirect()->route('account.profile')->withErrors('비밀번호가 변경되었습니다.'); } }