Class: PasswordResetController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/generators/authkit/templates/app/controllers/password_reset_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/generators/authkit/templates/app/controllers/password_reset_controller.rb', line 5

def create
  if user && user.send_reset_password
    logout

    respond_to do |format|
      format.json { head :no_content }
      format.html {
        flash[:notice] = "We've sent an email which can be used to change your password"
        redirect_to 
      }
    end
  else
    respond_to do |format|
      format.json { render json: { errors: ["Invalid user name or email"], status: "error" }, status: 422 }
      format.html {
        flash.now[:error] = "Invalid user name or email"
        render :show
      }
    end
  end
end

#showObject



2
3
# File 'lib/generators/authkit/templates/app/controllers/password_reset_controller.rb', line 2

def show
end