12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/lean_cms/sessions_controller.rb', line 12
def create
user_class = LeanCms.user_class.constantize
if user = user_class.authenticate_by(params.permit(:email_address, :password))
unless user.active?
redirect_to lean_cms_new_session_path, alert: "Your account has been deactivated. Please contact an administrator."
return
end
start_new_session_for user
user.record_login!
if user.must_change_password?
magic_link = LeanCms::MagicLink.create_for_password_reset(user)
redirect_to lean_cms_password_setup_path(token: magic_link.token), notice: "Please set a new password."
else
redirect_to after_authentication_url
end
else
redirect_to lean_cms_new_session_path, alert: "Try another email address or password."
end
end
|