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
46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/devise/displayqr_controller.rb', line 46 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
15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/devise/displayqr_controller.rb', line 15 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
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/devise/displayqr_controller.rb', line 25 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) if Gem::Version.new(Devise::VERSION) < Gem::Version.new('4.2.0') sign_in scope, resource, bypass: true else bypass_sign_in resource, scope: scope end respond_with resource, location: after_sign_in_path_for(resource) else render :show end end |