Module: SignInSimple
- Includes:
- SignIn
- Defined in:
- lib/sixarm_ruby_sign_in_simple.rb
Instance Method Summary collapse
-
#sign_in_attempt(options = nil) ⇒ Object
Implement interface of SignIn.
- #sign_in_error_no_password(options = nil) ⇒ Object
- #sign_in_error_no_password_message(options = nil) ⇒ Object
- #sign_in_error_no_username(options = nil) ⇒ Object
- #sign_in_error_no_username_message(options = nil) ⇒ Object
- #sign_in_failure(options = nil) ⇒ Object
- #sign_in_failure_message(options = nil) ⇒ Object
- #sign_in_not_found(options = nil) ⇒ Object
- #sign_in_not_found_message(options = nil) ⇒ Object
- #sign_in_password(options = nil) ⇒ Object
- #sign_in_username(options = nil) ⇒ Object
Instance Method Details
#sign_in_attempt(options = nil) ⇒ Object
Implement interface of SignIn
18 19 20 21 22 23 24 |
# File 'lib/sixarm_ruby_sign_in_simple.rb', line 18 def sign_in_attempt(=nil) username=sign_in_username; username and username!='' or sign_in_error_no_username() password=sign_in_password; password and password!='' or sign_in_error_no_password() u=User.find_by_username(username) u and u.password==password or sign_in_not_found() self.current_user=u end |
#sign_in_error_no_password(options = nil) ⇒ Object
58 59 60 |
# File 'lib/sixarm_ruby_sign_in_simple.rb', line 58 def sign_in_error_no_password(=nil) raise SecurityError, () end |
#sign_in_error_no_password_message(options = nil) ⇒ Object
62 63 64 |
# File 'lib/sixarm_ruby_sign_in_simple.rb', line 62 def (=nil) "Please type in your password." end |
#sign_in_error_no_username(options = nil) ⇒ Object
46 47 48 |
# File 'lib/sixarm_ruby_sign_in_simple.rb', line 46 def sign_in_error_no_username(=nil) raise SecurityError, () end |
#sign_in_error_no_username_message(options = nil) ⇒ Object
50 51 52 |
# File 'lib/sixarm_ruby_sign_in_simple.rb', line 50 def (=nil) "Please type in your username." end |
#sign_in_failure(options = nil) ⇒ Object
26 27 28 |
# File 'lib/sixarm_ruby_sign_in_simple.rb', line 26 def sign_in_failure(=nil) flash[:warning]=() end |
#sign_in_failure_message(options = nil) ⇒ Object
38 39 40 |
# File 'lib/sixarm_ruby_sign_in_simple.rb', line 38 def (=nil) "Sorry, your sign in failed." + ($! ? " #{$!}" : '') end |
#sign_in_not_found(options = nil) ⇒ Object
66 67 68 |
# File 'lib/sixarm_ruby_sign_in_simple.rb', line 66 def sign_in_not_found(=nil) raise SecurityError, () end |
#sign_in_not_found_message(options = nil) ⇒ Object
70 71 72 |
# File 'lib/sixarm_ruby_sign_in_simple.rb', line 70 def (=nil) "Sorry, the username/password combination is not registered." end |
#sign_in_password(options = nil) ⇒ Object
54 55 56 |
# File 'lib/sixarm_ruby_sign_in_simple.rb', line 54 def sign_in_password(=nil) params[:password] end |
#sign_in_username(options = nil) ⇒ Object
42 43 44 |
# File 'lib/sixarm_ruby_sign_in_simple.rb', line 42 def sign_in_username(=nil) params[:username] end |