mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-31 23:10:44 +00:00
17 lines
344 B
Ruby
17 lines
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
|