Class: Collavre::PasswordsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/collavre/passwords_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



10
11
12
13
14
15
16
# File 'app/controllers/collavre/passwords_controller.rb', line 10

def create
  if user = Collavre::User.find_by(email: params[:email])
    PasswordsMailer.reset(user).deliver_later
  end

  redirect_to new_session_path, notice: "Password reset instructions sent (if user with that email address exists)."
end

#editObject



18
19
# File 'app/controllers/collavre/passwords_controller.rb', line 18

def edit
end

#newObject



7
8
# File 'app/controllers/collavre/passwords_controller.rb', line 7

def new
end

#updateObject



21
22
23
24
25
26
27
# File 'app/controllers/collavre/passwords_controller.rb', line 21

def update
  if @user.update(params.permit(:password, :password_confirmation))
    redirect_to new_session_path, notice: "Password has been reset."
  else
    redirect_to edit_password_path(params[:token]), alert: "Passwords did not match."
  end
end