Require password reset #2225

Closed
maxf wants to merge 7 commits from gitlab-mr-iid-958 into develop
Member

If user is attempting to log in and API returns "password reset required" we redirect user to password reset page

If user is attempting to log in and API returns "password reset required" we redirect user to password reset page
Member

looks weird, why would one type of error be snake_case and other plain english...

looks weird, why would one type of error be snake_case and other plain english...
Author
Member

agree, let's unify. Do you think we should have snake case in both cases?

agree, let's unify. Do you think we should have snake case in both cases?
Author
Member

Now it looks weierd in back end context: pleroma/pleroma#5115/diffs

:thinking_face:

Now it looks weierd in back end context: https://git.pleroma.social/pleroma/pleroma/pulls/5115/diffs :thinking_face:
Author
Member

Before:

      {:auth_active, false} ->
        # Per https://github.com/tootsuite/mastodon/blob/
        #   51e154f5e87968d6bb115e053689767ab33e80cd/app/controllers/api/base_controller.rb#L76
        render_error(conn, :forbidden, "Your login is missing a confirmed e-mail address")

      {:user_active, false} ->
        render_error(conn, :forbidden, "Your account is currently disabled")

      {:password_reset_pending, true} ->
        render_error(conn, :forbidden, "Password reset is required")

Now:

      {:auth_active, false} ->
        # Per https://github.com/tootsuite/mastodon/blob/
        #   51e154f5e87968d6bb115e053689767ab33e80cd/app/controllers/api/base_controller.rb#L76
        render_error(conn, :forbidden, "Your login is missing a confirmed e-mail address")

      {:user_active, false} ->
        render_error(conn, :forbidden, "Your account is currently disabled")

      {:password_reset_pending, true} ->
        render_error(conn, :forbidden, "password_reset_required")
Before: ```elixir {:auth_active, false} -> # Per https://github.com/tootsuite/mastodon/blob/ # 51e154f5e87968d6bb115e053689767ab33e80cd/app/controllers/api/base_controller.rb#L76 render_error(conn, :forbidden, "Your login is missing a confirmed e-mail address") {:user_active, false} -> render_error(conn, :forbidden, "Your account is currently disabled") {:password_reset_pending, true} -> render_error(conn, :forbidden, "Password reset is required") ``` Now: ```elixir {:auth_active, false} -> # Per https://github.com/tootsuite/mastodon/blob/ # 51e154f5e87968d6bb115e053689767ab33e80cd/app/controllers/api/base_controller.rb#L76 render_error(conn, :forbidden, "Your login is missing a confirmed e-mail address") {:user_active, false} -> render_error(conn, :forbidden, "Your account is currently disabled") {:password_reset_pending, true} -> render_error(conn, :forbidden, "password_reset_required") ```
Member

well, unify on something at least then. Something that won't get changed because wording is bad.

well, unify on something at least then. Something that won't get changed because wording is bad.
Author
Member

I've did it via redirect

I've did it via redirect
Author
Member

@hj take a look please

@hj take a look please
Member

theme support

theme support
Member

I'd give it a bit more descriptive name like "passwordResetRequested"

I'd give it a bit more descriptive name like "passwordResetRequested"
Member

I'd add a sanity check so that we get "password_reset_required" we don't redirect to /password-reset if password reset is disabled, but show a message to contact administrator instead.

I'd add a sanity check so that we get "password_reset_required" we don't redirect to `/password-reset` if password reset is disabled, but show a message to contact administrator instead.
Member

is this used anywhere? I'd move the $t() to the template.

is this used anywhere? I'd move the `$t()` to the template.

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pleroma/pleroma-fe!2225
No description provided.