Class: Hello::Business::Authentication::SignIn
- Inherits:
-
Base
- Object
- Base
- Hello::Business::Authentication::SignIn
show all
- Defined in:
- lib/hello/business/authentication/sign_in.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Base
#alert_message, #error_message, #errors, #success_message, #t
Instance Attribute Details
#login ⇒ Object
Returns the value of attribute login.
5
6
7
|
# File 'lib/hello/business/authentication/sign_in.rb', line 5
def login
@login
end
|
#password ⇒ Object
Returns the value of attribute password.
5
6
7
|
# File 'lib/hello/business/authentication/sign_in.rb', line 5
def password
@password
end
|
Instance Method Details
#authenticate(login, password) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/hello/business/authentication/sign_in.rb', line 7
def authenticate(login, password)
@ignited = true
@login = login
@password = password
validates_presence_of :login, :password
return false if any_errors?
find_user_by_login
check_login_found
return false if any_errors?
check_password_matches
return false if any_errors?
true
end
|
#bad_login? ⇒ Boolean
25
26
27
|
# File 'lib/hello/business/authentication/sign_in.rb', line 25
def bad_login?
!!@bad_login
end
|
#bad_password? ⇒ Boolean
29
30
31
|
# File 'lib/hello/business/authentication/sign_in.rb', line 29
def bad_password?
!!@bad_password
end
|
#user ⇒ Object
33
34
35
|
# File 'lib/hello/business/authentication/sign_in.rb', line 33
def user
@user ||= ::User.new
end
|