|
|
@@ -128,15 +128,16 @@ class User extends Base |
|
|
|
*/ |
|
|
|
public function edit() |
|
|
|
{ |
|
|
|
$userInfo = $this->auth->getUserinfo(); |
|
|
|
$username = $this->request->post('username', $userInfo['username']); |
|
|
|
$mobile = $this->request->post('mobile', $userInfo['mobile']); |
|
|
|
$avatar = $this->request->post('avatar', $userInfo['avatar']); |
|
|
|
|
|
|
|
// $userInfo = $this->auth->getUserinfo(); |
|
|
|
// $username = $this->request->post('username', $userInfo['username']); |
|
|
|
$password = $this->request->post('password', ""); |
|
|
|
// $avatar = $this->request->post('avatar', $userInfo['avatar']); |
|
|
|
if (!$password){ |
|
|
|
$this->error(__('请填写密码'), 0); |
|
|
|
} |
|
|
|
$user = \app\common\model\User::get($this->auth->id); |
|
|
|
$user->username = $username; |
|
|
|
$user->mobile = $mobile; |
|
|
|
$user->avatar = $avatar; |
|
|
|
$pwd= \app\common\library\Auth::instance()->getEncryptPassword($password, $user->salt); |
|
|
|
$user->password = $pwd; |
|
|
|
if ($user->save()) { |
|
|
|
$this->success(__('Modified'), 1); |
|
|
|
} else { |
|
|
|