app/controllers/guts/sessions_controller.rb in guts-2.1.0 vs app/controllers/guts/sessions_controller.rb in guts-3.0.0
- old
+ new
@@ -2,12 +2,11 @@
module Guts
# Sessions controller
class SessionsController < ApplicationController
# Creation of a new session (login page)
- def new
- end
+ def new; end
# Checks the users session through post
# @note It will redirect to Guts::UsersController if successful and
# it will redirect back to #new if not
# @see Guts::SessionsHelper#log_in
@@ -30,15 +29,15 @@
flash[:notice] = 'You have been logged out'
redirect_to new_session_path
end
# Forgot password page
- def forgot
- end
+ def forgot; end
# Sends the user a new token by email to reset their password
def forgot_token
user = User.find_by(email: params[:session][:email].downcase)
+
if user
password = Digest::SHA1.hexdigest("#{Time.current}#{rand(100)}")[0, 8]
user.update_attribute(:password_token, password)
UserMailer.password_reset(user).deliver_now