Class: Devise::DisplayqrController
- Inherits:
-
DeviseController
- Object
- DeviseController
- Devise::DisplayqrController
- Includes:
- Controllers::Helpers
- Defined in:
- app/controllers/devise/displayqr_controller.rb
Instance Method Summary collapse
- #refresh ⇒ Object
-
#show ⇒ Object
GET /resource/displayqr.
- #update ⇒ Object
Instance Method Details
#refresh ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/devise/displayqr_controller.rb', line 33 def refresh unless resource.nil? resource.send(:assign_auth_secret) resource.save :notice, :newtoken sign_in scope, resource, :bypass => true redirect_to [resource_name, :displayqr] else redirect_to :root end end |
#show ⇒ Object
GET /resource/displayqr
7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/devise/displayqr_controller.rb', line 7 def show if resource.nil? || resource.gauth_secret.nil? sign_in resource_class.new, resource redirect_to stored_location_for(scope) || :root else @tmpid = resource.assign_tmp render :show end end |
#update ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/devise/displayqr_controller.rb', line 17 def update if resource.gauth_tmp != params[resource_name]['tmpid'] || !resource.validate_token(params[resource_name]['gauth_token'].to_i) (:error, :invalid_token) render :show return end if resource.set_gauth_enabled(params[resource_name]['gauth_enabled']) :notice, (resource.gauth_enabled? ? :enabled : :disabled) sign_in scope, resource, :bypass => true redirect_to stored_location_for(scope) || :root else render :show end end |