Class: Auth::PasswordsController
- Inherits:
-
BaseController
- Object
- DeviseController
- BaseController
- Auth::PasswordsController
- Defined in:
- app/controllers/auth/passwords_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /resource/password.
-
#edit ⇒ Object
GET /resource/password/edit?reset_password_token=abcdef.
-
#new ⇒ Object
GET /auth/password/new.
- #send_reset_pass ⇒ Object
-
#sent ⇒ Object
GET /resource/password/sent.
-
#update ⇒ Object
PUT /resource/password.
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
POST /resource/password
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/auth/passwords_controller.rb', line 15 def create self.resource = Auth::PasswordNewForm.new(params[resource_name]) # if successfully_sent?(resource) if resource.submit flash[:notification] = 'auth.new_password.succes' respond_with({}, location: after_sending_reset_password_instructions_path_for(resource_name)) else respond_with(resource) end end |
#edit ⇒ Object
GET /resource/password/edit?reset_password_token=abcdef
42 43 44 45 |
# File 'app/controllers/auth/passwords_controller.rb', line 42 def edit self.resource = resource_class.new resource.reset_password_token = params[:reset_password_token] end |
#new ⇒ Object
GET /auth/password/new
10 11 12 |
# File 'app/controllers/auth/passwords_controller.rb', line 10 def new self.resource = Auth::PasswordNewForm.new end |
#send_reset_pass ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/auth/passwords_controller.rb', line 27 def send_reset_pass self.resource = Auth::PasswordNewForm.new(params[resource_name]) respond_to do |format| format.json do if resource.submit render json: resource.to_json else render json: { errors: resource.errors }.to_json, status: :unprocessable_entity end end format.all { render_404 } end end |
#sent ⇒ Object
GET /resource/password/sent
67 68 69 |
# File 'app/controllers/auth/passwords_controller.rb', line 67 def sent @structure = ContentStorageType.password_sent.storage end |
#update ⇒ Object
PUT /resource/password
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'app/controllers/auth/passwords_controller.rb', line 48 def update self.resource = resource_class.reset_password_by_token(resource_params) if resource&.errors&.empty? resource.unlock_access! if unlockable?(resource) if ( :notice, resource.active_for_authentication? ? :updated : :updated_not_active ) end sign_in(resource_name, resource) respond_with resource, location: after_resetting_password_path_for(resource) else # resource.reset_password_token = resource_params[:reset_password_token] respond_with resource end end |