You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
633 B
21 lines
633 B
3 years ago
|
class Auth::SessionsController < Devise::SessionsController
|
||
3 years ago
|
include Helpers::Email
|
||
|
|
||
3 years ago
|
def create
|
||
|
self.resource = resource_class.new
|
||
|
if params.dig("user", "email").empty?
|
||
|
resource.errors.add :email, "Enter an email address"
|
||
|
elsif !email_valid?(params.dig("user", "email"))
|
||
|
resource.errors.add :email, "Enter an email address in the correct format, like name@example.com"
|
||
|
end
|
||
|
if params.dig("user", "password").empty?
|
||
|
resource.errors.add :password, "Enter a password"
|
||
|
end
|
||
|
if resource.errors.present?
|
||
|
render :new, status: :unprocessable_entity
|
||
|
else
|
||
|
super
|
||
|
end
|
||
|
end
|
||
|
end
|