修改用户密码
This commit is contained in:
parent
7d70a6b2cb
commit
40d0c03751
|
@ -38,7 +38,27 @@ module Mobile
|
||||||
us = UsersService.new
|
us = UsersService.new
|
||||||
begin
|
begin
|
||||||
ue = us.edit_user params.merge(id: current_user.id)
|
ue = us.edit_user params.merge(id: current_user.id)
|
||||||
{status: 0, data: ue}
|
present :data, user, with: Mobile::Entities::User
|
||||||
|
present :status, 0
|
||||||
|
rescue => e
|
||||||
|
{status: 1, message: e.message}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
desc '修改密码'
|
||||||
|
params do
|
||||||
|
requires :token, type: String
|
||||||
|
requires :password, type:String , desc: '原密码'
|
||||||
|
requires :new_password, type: String, desc: '新密码'
|
||||||
|
end
|
||||||
|
post 'password' do
|
||||||
|
authenticate!
|
||||||
|
us = UsersService.new
|
||||||
|
begin
|
||||||
|
ue = us.change_password params.merge(new_password_confirmation: params[:new_password])
|
||||||
|
present :data, user, with: Mobile::Entities::User
|
||||||
|
present :status, 0
|
||||||
rescue => e
|
rescue => e
|
||||||
{status: 1, message: e.message}
|
{status: 1, message: e.message}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue