修改用户密码

This commit is contained in:
guange 2014-12-10 16:51:19 +08:00
parent 7d70a6b2cb
commit 40d0c03751
1 changed files with 21 additions and 1 deletions

View File

@ -38,7 +38,27 @@ module Mobile
us = UsersService.new
begin
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
{status: 1, message: e.message}
end