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.
121 122 123 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 121 def initialize(site, params) @site, @params = site, params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
119 120 121 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 119 def params @params end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
119 120 121 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 119 def site @site end |
Instance Method Details
#action ⇒ Object
129 130 131 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 129 def action params[:auth_action] end |
#callback ⇒ Object
153 154 155 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 153 def callback params[:auth_callback] end |
#disable_email ⇒ Object
177 178 179 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 177 def disable_email [1, '1', 'true', true].include?(params[:auth_disable_email]) end |
#email_handle ⇒ Object
173 174 175 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 173 def email_handle params[:auth_email_handle] end |
#entry ⇒ Object
181 182 183 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 181 def entry params[:auth_entry] end |
#from ⇒ Object
165 166 167 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 165 def from smtp_config['sender'] || smtp_config['from'] || '[email protected]' end |
#id ⇒ Object
145 146 147 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 145 def id params[:auth_entry].try(:[], id_field) || params[:auth_id] end |
#id_field ⇒ Object
137 138 139 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 137 def id_field params[:auth_id_field] || :email end |
#password ⇒ Object
149 150 151 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 149 def password params[:auth_password] end |
#password_field ⇒ Object
141 142 143 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 141 def password_field params[:auth_password_field].try(:to_sym) || :password end |
#recaptcha_response ⇒ Object
189 190 191 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 189 def recaptcha_response params['g-recaptcha-response'] end |
#reset_password_url ⇒ Object
157 158 159 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 157 def reset_password_url params[:auth_reset_password_url] end |
#reset_token ⇒ Object
161 162 163 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 161 def reset_token params[:auth_reset_token] end |
#smtp ⇒ Object
193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 193 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
185 186 187 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 185 def smtp_config @config ||= _read_smtp_config end |
#subject ⇒ Object
169 170 171 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 169 def subject params[:auth_email_subject] || 'Instructions for changing your password' end |
#type ⇒ Object
133 134 135 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 133 def type params[:auth_content_type] end |
#valid? ⇒ Boolean
125 126 127 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 125 def valid? ACTIONS.include?(action) end |