Redirect to root after password reset
CI / Test (pull_request) Successful in 32s
Release Drafter / Update release notes draft (pull_request) Successful in 2s

This commit is contained in:
2026-08-10 11:22:03 -06:00
parent 29a9dee1cb
commit 89184cd851
3 changed files with 63 additions and 1 deletions
+36
View File
@@ -0,0 +1,36 @@
require 'rails_helper'
RSpec.describe "Devise password reset", type: :request do
let(:user) { create :user }
describe "PUT /users/password" do
let(:token) { user.send(:set_reset_password_token) }
before do
allow(Devise::LDAP::Adapter).to receive(:update_password).and_return(true)
end
context "with a stale stored return location from an rs/oauth request" do
before do
get new_rs_oauth_url(user.cn,
redirect_uri: "https://example.com",
client_id: "https://example.com",
scope: "documents")
expect(session[:user_return_to]).to be_present
end
it "redirects to the dashboard instead of the stored return URL" do
put user_password_path, params: {
user: {
reset_password_token: token,
password: "a brand new password",
password_confirmation: "a brand new password"
}
}
expect(response).to redirect_to(root_path)
expect(session[:user_return_to]).to be_nil
end
end
end
end