mirror of
https://github.com/v2board/v2board.git
synced 2025-01-30 18:19:12 +08:00
update
This commit is contained in:
parent
af72bb1a9b
commit
7d4fd24a92
@ -18,6 +18,26 @@ class UserController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function changePassword (Request $request) {
|
||||
if (empty($request->input('old_password'))) {
|
||||
abort(500, '旧密码不能为空');
|
||||
}
|
||||
if (empty($request->input('new_password'))) {
|
||||
abort(500, '新密码不能为空');
|
||||
}
|
||||
$user = User::find($request->session()->get('id'));
|
||||
if (!password_verify($request->input('old_password'), $user->password)) {
|
||||
abort(500, '旧密码有误');
|
||||
}
|
||||
$user->password = password_hash($request->input('new_password'), PASSWORD_DEFAULT);
|
||||
if (!$user->save()) {
|
||||
abort(500, '保存失败');
|
||||
}
|
||||
return response([
|
||||
'data' => true
|
||||
]);
|
||||
}
|
||||
|
||||
public function index (Request $request) {
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,7 @@ Route::prefix('v1')
|
||||
Route::get('subscribe', 'UserController@subscribe');
|
||||
Route::get('logout', 'UserController@logout');
|
||||
Route::get('info', 'UserController@info');
|
||||
Route::post('changePassword', 'UserController@changePassword');
|
||||
// Order
|
||||
Route::get('order', 'OrderController@index');
|
||||
Route::post('order/save', 'OrderController@save');
|
||||
|
Loading…
Reference in New Issue
Block a user