|
@@ -253,7 +253,15 @@ class User extends CatchController
|
|
|
*/
|
|
|
public function profile(ProfileRequest $request)
|
|
|
{
|
|
|
- return CatchResponse::success($this->user->updateBy($request->user()->id, $request->param()));
|
|
|
+ $params=$request->param();
|
|
|
+ $password = $params['password']; // 假设密码是 p@ssw0rd
|
|
|
+
|
|
|
+ if (preg_match('/^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$/', $password)) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ return CatchResponse::fail('密码不符合规则');
|
|
|
+ }
|
|
|
+ return CatchResponse::success($this->user->updateBy($request->user()->id, $params));
|
|
|
}
|
|
|
|
|
|
/**
|