8000 Fixed password bugs by jupiter007 · Pull Request #807 · CDLUC3/dmptool · GitHub
[go: up one dir, main page]

Skip to content

Fixed password bugs - #807

Open
jupiter007 wants to merge 4 commits into
v5from
bug/805/JS-fix-password-bugs
Open

jupiter007 wants to merge 4 commits into
v5from
bug/805/JS-fix-password-bugs

Conversation

@jupiter007
@jupiter007 jupiter007 commented Oct 7, 2026 •
Copy link
Copy Markdown
Collaborator

Fixes # 805 and 806

Changes proposed in this PR:

  • For the bug where the user stays on the password form view after submitting, this is what I found:
    The account that had the sign-in bug has an invitation that was never accepted. It looks like authenticatable.rb (L52-L58) sets new user data in memory, and tries to set the user's org equal to the one from email domain, so the original org_id value is wiped out in memory.
    Then in sessions_controller.rb in the create function, in the else, the code assumes that only an email was provided, so it always renders the next password sign-up form.
    Fix: Updated the create function in sessions_controller.rb to keep the User's existing Org if one could not be determined from the email domain. Also, fixed password show/hide toggle not working on reset password. Two identical files were loading and had the same calls to togglisePasswords. ./src/devise/passwords/edit was commented out in application.js.

  • For the show/hide toggle not working on the Password reset page, the problem was arising from the fact that togglisePasswords was being loaded twice by two different identical files in application.js: ./src/devise/passwords/edit and dmptool/users/passwords/edit.js.

Fix: I commented out the ./src/devise/passwords/edit and kept the one under ./dmptool since it's the newer one.

  • Also update patch and minor gem dependencies and addressed high vulnerabilities in JS packages.

Testing

  • I pushed up the changes to stage and tested this. Could no longer reproduce the two bugs.

@jupiter007
Copy link
Copy Markdown
Collaborator Author

Oh I forgot to update gem dependencies and JS dependencies. Will put into DRAFT mode.

@jupiter007
jupiter007 marked this pull request as draft October 7, 2026 20:51
@jupiter007
jupiter007 marked this pull request as ready for review October 8, 2026 02:05
@jupiter007
Copy link
Copy Markdown
Collaborator Author

I updated gem dependencies (patch and minor) and high JS vulnerabilities, and tested on "stage".

extend ActiveSupport::Concern

included do
# Not every including controller defines both :create and :update (e.g. SessionsController
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the callbacks from only: %i[create update] to an if: condition. SessionsController has no update action, and with raise_on_missing_callback_actions enabled in development and test, Rails raised an error on login. The callbacks still run only on create and update. Also restored before_action :assign_instance_variables, which was accidentally removed and broke SSO on stage.

resource.firstname = nil
resource.surname = nil
resource.org = org_from_email_domain(email_domain: resource.email&.split('@')&.last)
# Keep the User's existing Org if one could not be determined from the email domain
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix the issue where a user stays on the sign-in form after logging in.

// those JS files anymore, so commenting out below
// ----------------------------------------------------------
import './src/devise/passwords/edit';
//import './src/devise/passwords/edit'; - totally identical to dmptool/users/passwords/edit.js, so commenting out
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented this identical import out, because togglisePasswords was loaded twice breaking the show/hide password checkbox on the reset password page

@briri briri left a comment
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this all looks good @jupiter007

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0