mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-27 21:10:54 +00:00
17 lines
No EOL
344 B
Ruby
17 lines
No EOL
344 B
Ruby
module Controllers
|
|
module SessionHelpers
|
|
def login_admin
|
|
user = Group.admins.first.user
|
|
login(user.username)
|
|
end
|
|
|
|
def login(username)
|
|
user = User.where(:username => username.to_s).first
|
|
request.session[:user] = user.id
|
|
end
|
|
|
|
def current_user
|
|
User.find(request.session[:user])
|
|
end
|
|
end
|
|
end |