ruby on rails - Devise Not Validating Password/Password Confirmation -


i have custom controller handles editing of user passwords based off of code here.

user model

attr_accessible :password, :password_confirmation, :username, :login ... devise :database_authenticatable,         :lockable,         :registerable,         :recoverable,         :rememberable,         :trackable 

passwordscontroller

expose(:user) { current_user }  def update   if user.update_with_password(params[:user])     sign_in(user, :bypass => true)     flash[:notice] = "success"   else     render :edit   end end 

my edit password form located here.

the problem no matter enter (or don't enter matter) edit password form, "success" flash method displayed.

if want devise validations, need add :validatable module model. easy do, add :validatable list of module in devise call, model says:

devise    :database_authenticatable,     :lockable,     :registerable,     :recoverable,     :rememberable,     :trackable,    :validatable 

this make devise add validations.

another easy way add own validations. if want validate password confirmation matches, can add validates_confirmation_of validation adding model:

validates_confirmation_of :password 

i hope helps.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -