not idiomatic for controller actions to call each other; fix username field

This commit is contained in:
Peter Bhat Harkins 2023-09-08 18:01:29 -05:00
parent 8f0a2007c6
commit 69dfe95d64
2 changed files with 4 additions and 3 deletions

View File

@ -29,6 +29,7 @@ class LoginController < ApplicationController
end
def login
@title = "Login"
user = if /@/.match?(params[:email].to_s)
User.where(email: params[:email]).first
else
@ -100,7 +101,7 @@ class LoginController < ApplicationController
flash.now[:error] = fail_reason
@referer = params[:referer]
index
render "index"
end
def forgot_password
@ -131,7 +132,7 @@ class LoginController < ApplicationController
@found_user.initiate_password_reset_for_ip(request.remote_ip)
flash.now[:success] = "Password reset instructions have been e-mailed to you."
index
render "index"
end
def set_new_password

View File

@ -9,7 +9,7 @@
<%= form_with url: login_path do |form| %>
<p>
<%= form.label :email, "E-mail or Username:" %>
<%= form.email_field :email, :size => 40, :inputmode => "email", :autofocus => "autofocus" %>
<%= form.text_field :email, :size => 40, :inputmode => "email", :autofocus => "autofocus" %>
<br />
<%= form.label :password, "Password:" %>