Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Password reset is not updated and login page is doesn't open #365

Open
ahmed1988 opened this Issue · 0 comments

1 participant

@ahmed1988

Hi Friends,

I'm new of authlogic in rails 2.3.4, currently i'm trying to set password reset activity. In that password is not updated after conformation of mail, and also my login page is doesn't opened after set the password reset, please help me.

model/user.rb :
class User < ActiveRecord::Base
acts_as_authentic do |c|
c.validate_email_field = false
end
before_update :activate_user
def activate_user
self.update_attribute("active",true)
end
def deliver_password_reset_instructions!

reset_perishable_token!

Notifier.deliver_password_reset_instructions(self)

end
end

controller/password_reset_controller.rb

class PasswordResetsController < ApplicationController

skip_before_filter :require_user
layout 'login'
def update

@user = User.find_by_perishable_token(params[:id])
@user.password = params[:user][:password]

@user.password_confirmation = params[:user][:password_confirmation]
if @user.save

flash[:notice] = "Password successfully updated"

redirect_to login_path

else

render :action => :edit

end

end

Controller/ user_sessions_controller.rb

class UserSessionsController < ApplicationController
before_filter :require_no_user, :only => [:new, :create]
before_filter :require_user, :only => :destroy
layout 'login'
def new
@user_session = UserSession.new
end

def create
@user_session = UserSession.new(params[:user_session])
if @user_session.save
flash[:notice] = "Login successful!"
redirect_to :controller=>"home"

else

render :action => :new
end
end
end

Thanks&Regards
Ahmed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.