Module: AuthLh::Authentication::ClassMethods
- Defined in:
- lib/auth_lh/authentication.rb
Instance Method Summary collapse
- #all_external ⇒ Object
- #change_password_url ⇒ Object
- #find_current_user(session_token, remote_ip) ⇒ Object
- #find_external(login) ⇒ Object
- #login_url ⇒ Object
- #logout_url ⇒ Object
Instance Method Details
#all_external ⇒ Object
20 21 22 |
# File 'lib/auth_lh/authentication.rb', line 20 def all_external AuthLh.get_users end |
#change_password_url ⇒ Object
64 65 66 |
# File 'lib/auth_lh/authentication.rb', line 64 def change_password_url AuthLh.change_password_url end |
#find_current_user(session_token, remote_ip) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/auth_lh/authentication.rb', line 28 def find_current_user(session_token, remote_ip) if (session_token.present? && (@session_token != session_token)) response = AuthLh.get_current_user(session_token, remote_ip) if response.nil? @cached_logged_user = nil @session_token = nil @login_error = nil else @cached_logged_user = response.user @session_token = session_token @login_error = response.reason end end if @cached_logged_user user = find_or_create_by(login: @cached_logged_user.login) user.auth_user = @cached_logged_user user else nil end end |
#find_external(login) ⇒ Object
24 25 26 |
# File 'lib/auth_lh/authentication.rb', line 24 def find_external(login) all_external.find { |x| x.login == login.to_s } end |
#login_url ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/auth_lh/authentication.rb', line 52 def login_url if @login_error "#{AuthLh.login_url}&reason=#{@login_error}" else AuthLh.login_url end end |
#logout_url ⇒ Object
60 61 62 |
# File 'lib/auth_lh/authentication.rb', line 60 def logout_url AuthLh.logout_url end |