Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8099455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:24:55+00:00 2026-06-05T22:24:55+00:00

The title is a little confusing so I will explain. I have the following

  • 0

The title is a little confusing so I will explain.
I have the following controller method:

  def password_update
      @op = params[:old_password]
      @np = params[:new_password]
      @cp = params[:confirm_password]

      if @np == @cp
        if !@np.empty?
          if current_user.update_with_password(:current_password=> @op)
              current_user.password = @np
              if current_user.save
                flash[:notice] = "Password Successfully Changed"
                redirect_to settings_path and return 
              end 
          else
            flash[:notice] = "Incorrent Current Password"
            redirect_to change_password_path and return 
          end
        else
          flash[:notice] = "New Password Cannot Be Blank"
        end   
      elsel
        flash[:notice] = "Incorrect Password Confirmation"
      end
      redirect_to change_password_path
    end

Everything else works nicely, meaning that I have working routes and views that bring you to this method and call it upon form submission. The error arises, however, when I attempt to correctly change my password. BTW, I am using Devise. When I click submit, I get logged out and it says “you must be signed in to complete this action”. So I try to sign in, my current password does not work. It has CHANGED my password (to the one I set in the form)! It tells me that I must be signed in (which I am when I attempt to change my password) but it still changes it.

Any help is welcome, however, I am a novice and would greatly appreciate a detailed explanation. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:24:56+00:00Added an answer on June 5, 2026 at 10:24 pm

    I believe that this page in the Devise wiki answers your question: https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-password

    This code in particular

     if @user.update_attributes(params[:user])
       # Sign in the user by passing validation in case his password changed
       sign_in @user, :bypass => true
       redirect_to root_path
     else
       render "edit"
     end
    

    and the bypass option seems well named as well. Hope this helps. Cheers

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the title might be a little bit confusing, let me explain, ;) I have
Ok the title maybe a little confusing. I have a database with the table
Yes, I know the title sounds a little suspicious. I will try to explain
Yes title is a little confusing but let me tell you what I have
The phrasing of the title may be a little confusing. I have an app
Title may be a little confusing, so let me explain. I am trying to
let me explain the title a little. In the framebuffer I have some color
Okay, the post title might be a little confusing. I have this code: class
I'm sorry for the little confusing title but say I have a class with
Sorry if the title is a little vague, I have the following sceneraio: I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.