upgrade refactor
This commit is contained in:
@@ -34,7 +34,7 @@ class NewSupplier
|
||||
return true if current_employee.present?
|
||||
return false unless email.present? and password.present?
|
||||
existing_employee = Employee.find_by_email email
|
||||
if existing_employee.valid_password?(password)
|
||||
if existing_employee.try(:valid_password?, password)
|
||||
@employee = existing_employee
|
||||
return true
|
||||
end
|
||||
@@ -60,6 +60,7 @@ class NewSupplier
|
||||
return if @employee = current_employee
|
||||
if Employee.count_by_email(email) > 0
|
||||
employee = Employee.find_by_email(email)
|
||||
# Login employee when valid password is given for signup
|
||||
if employee.valid_password? password
|
||||
@employee = employee
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user