10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/masq/sessions_controller.rb', line 10
def create
self.current_account = Masq::Account.authenticate(params[:login], params[:password])
if logged_in?
flash[:notice] = t(:you_are_logged_in)
redirect_after_login
else
a = Masq::Account.find_by(login: params[:login])
if a.nil?
redirect_to(login_path(error: "incorrect-login"), alert: t(:login_incorrect))
elsif a.active? && a.enabled?
redirect_to(login_path(error: "incorrect-password"), alert: t(:password_incorrect))
elsif !a.enabled?
redirect_to(login_path(error: "deactivated"), alert: t(:account_deactivated))
else
redirect_to(login_path(resend_activation_for: params[:login]), alert: t(:account_not_yet_activated))
end
end
end
|