Module: Omnigollum::Helpers
- Defined in:
- lib/omnigollum.rb
Instance Method Summary collapse
- #auth_config ⇒ Object
- #commit_message ⇒ Object
- #get_user ⇒ Object
- #kick_back ⇒ Object
- #show_login ⇒ Object
- #user_auth ⇒ Object
- #user_authed? ⇒ Boolean
- #user_deauth ⇒ Object
Instance Method Details
#auth_config ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/omnigollum.rb', line 57 def auth_config = settings.send(:omnigollum) @auth = { :route_prefix => [:route_prefix], :providers => [:provider_names], :path_images => [:path_images], :logo_suffix => [:logo_suffix], :logo_missing => [:logo_missing] } end |
#commit_message ⇒ Object
75 76 77 78 79 80 81 82 |
# File 'lib/omnigollum.rb', line 75 def if user_authed? user = get_user return { :message => params[:message], :name => user.name, :email => user.email} else return { :message => params[:message]} end end |
#get_user ⇒ Object
49 50 51 |
# File 'lib/omnigollum.rb', line 49 def get_user session[:auth_user] end |
#kick_back ⇒ Object
42 43 44 45 46 47 |
# File 'lib/omnigollum.rb', line 42 def kick_back redirect !request.referrer.nil? && request.referrer !~ /#{Regexp.escape(settings.send(:omnigollum)[:route_prefix])}\/.*/ ? request.referrer: '/' halt end |
#show_login ⇒ Object
69 70 71 72 73 |
# File 'lib/omnigollum.rb', line 69 def show_login auth_config require settings.send(:omnigollum)[:path_views] + '/login' halt mustache Omnigollum::Views::Login end |
#user_auth ⇒ Object
36 37 38 39 40 |
# File 'lib/omnigollum.rb', line 36 def user_auth @title = 'Authentication is required' @subtext = 'Please choose a login service' show_login end |
#user_authed? ⇒ Boolean
32 33 34 |
# File 'lib/omnigollum.rb', line 32 def user_authed? session.has_key? :auth_user end |
#user_deauth ⇒ Object
53 54 55 |
# File 'lib/omnigollum.rb', line 53 def user_deauth session.delete :auth_user end |