Class: Oxen::AuthController

Inherits:
ApplicationController show all
Defined in:
app/controllers/oxen/auth_controller.rb

Instance Method Summary collapse

Instance Method Details

#authObject



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  and return
  end

   = params[:login]
  psd = params[:password]
  hsh_psd = Digest::SHA2.hexdigest(psd)
  ac =  Account.where(login: ,hashed_password: hsh_psd).first
  if ac
    session[:login] = 
    flash[:notice] = "登录成功"
    redirect_to main_app.home_path and return
  else
    flash[:alert] = "登录失败"
    redirect_to  and return
  end
end

#loginObject



26
27
# File 'app/controllers/oxen/auth_controller.rb', line 26

def 
end

#logoutObject



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