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 login_path
}
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
|