Class: Oxen::AuthController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Oxen::AuthController
- Defined in:
- app/controllers/oxen/auth_controller.rb
Instance Method Summary collapse
Instance Method Details
#auth ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/oxen/auth_controller.rb', line 6 def auth unless verify_rucaptcha? flash[:alert] = "验证码出错" redirect_to login_path and return end login = params[:login] psd = params[:password] hsh_psd = Digest::SHA2.hexdigest(psd) ac = Account.where(login: login,hashed_password: hsh_psd).first if ac session[:login] = login flash[:notice] = "登录成功" redirect_to main_app.home_path and return else flash[:alert] = "登录失败" redirect_to login_path and return end end |
#login ⇒ Object
26 27 |
# File 'app/controllers/oxen/auth_controller.rb', line 26 def login end |
#logout ⇒ Object
29 30 31 32 33 |
# File 'app/controllers/oxen/auth_controller.rb', line 29 def logout reset_session flash[:notice] = "成功退出" redirect_to main_app.home_path end |