Browse Source

修改密码/退出的测试

tags/v1
sylor_huang@126.com 6 years ago
parent
commit
496b26252f
3 changed files with 13 additions and 2 deletions
  1. +11
    -1
      app/controllers/accounts_controller.rb
  2. +1
    -1
      app/controllers/concerns/login_helper.rb
  3. +1
    -0
      config/routes.rb

+ 11
- 1
app/controllers/accounts_controller.rb View File

@@ -52,7 +52,6 @@ class AccountsController < ApplicationController
u.login = user_params["login"] if user_params["login"]
u.mail = user_params["mail"] if user_params["mail"]
u.lastname = user_params["lastname"] if user_params["lastname"]
u.password = user_params["password"] if user_params["password"]
ue.gender = user_extension_params["gender"]
ue.school_id = user_extension_params["school_id"]
@@ -96,6 +95,17 @@ class AccountsController < ApplicationController
end
end
#修改密码
def remote_password
@user = User.find_by(login: params[:login])
if @user && @user.update_attribute(:password, params[:new_password])
render_ok({})
else
render_error("更新是不")
end
end
# 用户注册


+ 1
- 1
app/controllers/concerns/login_helper.rb View File

@@ -44,7 +44,7 @@ module LoginHelper
end

def logout_user
Rails.logger.info("####################__11111______######")
Rails.logger.info("####################_1111_User.current_id______######{User.current.try(:id)}###___#{User.current.logged?}")

if User.current.logged?
Rails.logger.info("####################__2222_______######")


+ 1
- 0
config/routes.rb View File

@@ -124,6 +124,7 @@ Rails.application.routes.draw do
post :remote_register
post :remote_update
post :remote_login
post :remote_password
end
end


Loading…
Cancel
Save