Class: Locomotive::Steam::Middlewares::Auth::AuthOptions
- Inherits:
-
Object
- Object
- Locomotive::Steam::Middlewares::Auth::AuthOptions
- Defined in:
- lib/locomotive/steam/middlewares/auth.rb
Constant Summary collapse
- ACTIONS =
%w(sign_up sign_in sign_out forgot_password reset_password)
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Instance Method Summary collapse
- #action ⇒ Object
- #callback ⇒ Object
- #disable_email ⇒ Object
- #email_handle ⇒ Object
- #entry ⇒ Object
- #from ⇒ Object
- #id ⇒ Object
- #id_field ⇒ Object
-
#initialize(site, params) ⇒ AuthOptions
constructor
A new instance of AuthOptions.
- #password ⇒ Object
- #password_field ⇒ Object
- #recaptcha_response ⇒ Object
- #reset_password_url ⇒ Object
- #reset_token ⇒ Object
- #smtp ⇒ Object
- #smtp_config ⇒ Object
- #subject ⇒ Object
- #type ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(site, params) ⇒ AuthOptions
Returns a new instance of AuthOptions.
116 117 118 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 116 def initialize(site, params) @site, @params = site, params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
114 115 116 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 114 def params @params end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
114 115 116 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 114 def site @site end |
Instance Method Details
#action ⇒ Object
124 125 126 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 124 def action params[:auth_action] end |
#callback ⇒ Object
148 149 150 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 148 def callback params[:auth_callback] end |
#disable_email ⇒ Object
172 173 174 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 172 def disable_email [1, '1', 'true', true].include?(params[:auth_disable_email]) end |
#email_handle ⇒ Object
168 169 170 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 168 def email_handle params[:auth_email_handle] end |
#entry ⇒ Object
176 177 178 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 176 def entry params[:auth_entry] end |
#from ⇒ Object
160 161 162 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 160 def from smtp_config['sender'] || '[email protected]' end |
#id ⇒ Object
140 141 142 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 140 def id params[:auth_entry].try(:[], id_field) || params[:auth_id] end |
#id_field ⇒ Object
132 133 134 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 132 def id_field params[:auth_id_field] || :email end |
#password ⇒ Object
144 145 146 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 144 def password params[:auth_password] end |
#password_field ⇒ Object
136 137 138 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 136 def password_field params[:auth_password_field].try(:to_sym) || :password end |
#recaptcha_response ⇒ Object
184 185 186 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 184 def recaptcha_response params["g-recaptcha-response"] end |
#reset_password_url ⇒ Object
152 153 154 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 152 def reset_password_url params[:auth_reset_password_url] end |
#reset_token ⇒ Object
156 157 158 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 156 def reset_token params[:auth_reset_token] end |
#smtp ⇒ Object
188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 188 def smtp if smtp_config.blank? {} else { address: smtp_config['address'], port: smtp_config['port'], user_name: smtp_config['user_name'], password: smtp_config['password'], authentication: smtp_config['authentication'] || 'plain', enable_starttls_auto: (smtp_config['enable_starttls_auto'] || "0").to_bool, } end end |
#smtp_config ⇒ Object
180 181 182 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 180 def smtp_config @config ||= _read_smtp_config end |
#subject ⇒ Object
164 165 166 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 164 def subject params[:auth_email_subject] || 'Instructions for changing your password' end |
#type ⇒ Object
128 129 130 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 128 def type params[:auth_content_type] end |
#valid? ⇒ Boolean
120 121 122 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 120 def valid? ACTIONS.include?(action) end |