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
- #reset_password_url ⇒ Object
- #reset_token ⇒ Object
- #smtp ⇒ Object
- #subject ⇒ Object
- #type ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(site, params) ⇒ AuthOptions
Returns a new instance of AuthOptions.
127 128 129 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 127 def initialize(site, params) @site, @params = site, params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
125 126 127 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 125 def params @params end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
125 126 127 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 125 def site @site end |
Instance Method Details
#action ⇒ Object
135 136 137 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 135 def action params[:auth_action] end |
#callback ⇒ Object
159 160 161 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 159 def callback params[:auth_callback] end |
#disable_email ⇒ Object
183 184 185 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 183 def disable_email [1, '1', 'true', true].include?(params[:auth_disable_email]) end |
#email_handle ⇒ Object
179 180 181 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 179 def email_handle params[:auth_email_handle] end |
#entry ⇒ Object
187 188 189 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 187 def entry params[:auth_entry] end |
#from ⇒ Object
171 172 173 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 171 def from params[:auth_email_from] || '[email protected]' end |
#id ⇒ Object
151 152 153 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 151 def id params[:auth_entry].try(:[], id_field) || params[:auth_id] end |
#id_field ⇒ Object
143 144 145 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 143 def id_field params[:auth_id_field] || :email end |
#password ⇒ Object
155 156 157 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 155 def password params[:auth_password] end |
#password_field ⇒ Object
147 148 149 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 147 def password_field params[:auth_password_field].try(:to_sym) || :password end |
#reset_password_url ⇒ Object
163 164 165 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 163 def reset_password_url params[:auth_reset_password_url] end |
#reset_token ⇒ Object
167 168 169 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 167 def reset_token params[:auth_reset_token] end |
#smtp ⇒ Object
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 191 def smtp name = params[:auth_email_smtp_namespace] || 'smtp' namespace = site..try(:[], name) if namespace.blank? Locomotive::Common::Logger.error "[Auth] Missing SMTP settings in the Site metafields. Namespace: #{name}".light_red return {} end { address: namespace[params[:auth_email_smtp_address_alias] || 'address'], port: namespace[params[:auth_email_smtp_port_alias] || 'port'], user_name: namespace[params[:auth_email_smtp_user_name_alias] || 'user_name'], password: namespace[params[:auth_email_smtp_password_alias] || 'password'] } end |
#subject ⇒ Object
175 176 177 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 175 def subject params[:auth_email_subject] || 'Instructions for changing your password' end |
#type ⇒ Object
139 140 141 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 139 def type params[:auth_content_type] end |
#valid? ⇒ Boolean
131 132 133 |
# File 'lib/locomotive/steam/middlewares/auth.rb', line 131 def valid? ACTIONS.include?(action) end |