Class: Ixtlan::UserManagement::Authenticator
- Inherits:
-
Object
- Object
- Ixtlan::UserManagement::Authenticator
- Defined in:
- lib/ixtlan/user_management/authenticator.rb
Instance Method Summary collapse
-
#initialize(restserver) ⇒ Authenticator
constructor
A new instance of Authenticator.
- #login(username_or_email, password) ⇒ Object
- #logout(user) ⇒ Object
- #ping(user) ⇒ Object
- #reset_password(username_or_email) ⇒ Object
- #user_new(params) ⇒ Object
Constructor Details
#initialize(restserver) ⇒ Authenticator
Returns a new instance of Authenticator.
27 28 29 |
# File 'lib/ixtlan/user_management/authenticator.rb', line 27 def initialize( restserver ) @restserver = restserver end |
Instance Method Details
#login(username_or_email, password) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ixtlan/user_management/authenticator.rb', line 35 def login( username_or_email, password ) user = nil @restserver.create( Authentication.new( :login => username_or_email, :password => password) ) do |json, req| user = user_new( MultiJson.load( json ) ) unless json.strip == '' #tell restserver to ignore response nil end user end |
#logout(user) ⇒ Object
61 62 63 |
# File 'lib/ixtlan/user_management/authenticator.rb', line 61 def logout( user ) # do nothing end |
#ping(user) ⇒ Object
57 58 59 |
# File 'lib/ixtlan/user_management/authenticator.rb', line 57 def ping( user ) # do nothing end |
#reset_password(username_or_email) ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ixtlan/user_management/authenticator.rb', line 46 def reset_password( username_or_email ) result = nil @restserver.create( Authentication.new( :login => username_or_email ), :reset_password ) do |json, req| result = json unless json.strip == '' #tell restserver to ignore response nil end result end |