Repository navigation
feat(2fa): enable/disable toggle on the profile and 2FA field on the admin user CRUD #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
smarcet
merged 26 commits into
feat/mfa-phase1---migrations--and--interfaces
from
feat/mfa-2fa-disable-toggle-and-admin-crud
Nov 20, 2026
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
81c23d0
feat(2fa): add POST users/me/2fa/disable and expose the 2FA state thr…
romanetar 37b3da1
feat(2fa): pass the stored 2FA flag and the group enforcement separat…
romanetar 54742f8
feat(2fa): replace the enable button with a 2FA switch and a disable …
romanetar 4ae5b47
feat(2fa): let a server admin enable or disable 2FA from the user CRUD
romanetar 4c891ae
feat(2fa): add the 2FA checkbox to the admin edit user form
romanetar 3d5cd1b
test(2fa): cover the password login after disabling 2FA and for a gro…
romanetar fbf805c
fix(2fa): show the disable password error inside the confirmation dialog
romanetar 4572d35
fix(2fa): roll back the admin user update when 2FA cannot be enabled
romanetar 79ac384
fix(2fa): ignore two_factor_enabled on the OAuth2 user update endpoint
romanetar 210cc6c
fix(2fa): check group enforcement against the groups of the same update
romanetar 4051c87
fix(2fa): make the admin 2FA checkbox read only on the admin's own ac…
romanetar 5b3d3aa
fix(2fa): send two_factor_enabled from the admin form only when the a…
romanetar 39f570a
fix(2fa): publish and audit the admin user update when the 2FA step f…
romanetar d2638c8
fix(2fa): rate limit password confirmation on 2FA disable and code re…
romanetar 94f3022
fix(2fa): audit enrollment_changed when 2FA is disabled by the user o…
romanetar b8df7c0
fix(2fa): audit enrollment_changed in the disable callers, not in the…
romanetar c7ebfd1
fix(2fa): describe the recovery code enrollment modal in the admin-en…
romanetar d8b3213
fix(2fa): require CSRF on the admin user update routes
romanetar 72372bf
fix(2fa): refuse a 2FA change from a server admin who is not an admin…
romanetar 368da2f
fix(2fa): refresh the admin form 2FA state from the saved user
romanetar 8d96f90
fix(2fa): hide or refresh the trusted devices when the 2FA switch cha…
romanetar 6061de7
fix(2fa): keep the trusted devices of a group-enforced user on the pr…
romanetar a41c27e
fix(2fa): send the CSRF token of the picture upload as a header
romanetar 2180a46
fix(2fa): honour the kill-switch in the profile and guard 2fa/enable …
romanetar 6715f43
fix(2fa): refuse an admin enabling 2FA for a user already enforced by…
romanetar ca8ecf8
fix(2fa): dispatch UserEmailUpdated only after the 2FA precondition c…
romanetar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| <?php namespace App\Mail; | ||
| /** | ||
| * Copyright 2026 OpenStack Foundation | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| **/ | ||
|
|
||
| use Auth\User; | ||
| use Illuminate\Bus\Queueable; | ||
| use Illuminate\Mail\Mailable; | ||
| use Illuminate\Queue\SerializesModels; | ||
| use Illuminate\Support\Facades\Config; | ||
| use Illuminate\Support\Facades\Log; | ||
| use Illuminate\Support\Facades\URL; | ||
|
|
||
| /** | ||
| * Class TwoFactorEnabledByAdminMail | ||
| * Tells a user that an administrator turned two-factor authentication on for their | ||
| * account. The user gets the recovery codes at the next sign-in, in the enrollment | ||
| * modal shown after the verification code, or later from the profile page. | ||
| * The mail never carries recovery codes. | ||
| * @package App\Mail | ||
| */ | ||
| class TwoFactorEnabledByAdminMail extends Mailable | ||
| { | ||
| use Queueable, SerializesModels; | ||
|
|
||
| public $tries = 2; | ||
|
|
||
| /** | ||
| * @var string | ||
| */ | ||
| public $user_email; | ||
|
|
||
| /** | ||
| * @var string | ||
| */ | ||
| public $user_fullname; | ||
|
|
||
| /** | ||
| * @var string | ||
| */ | ||
| public $profile_url; | ||
|
|
||
| /** | ||
| * The subject of the message. | ||
| * | ||
| * @var string | ||
| */ | ||
| public $subject; | ||
|
|
||
| /** | ||
| * @param User $user | ||
| */ | ||
| public function __construct(User $user) | ||
| { | ||
| $this->user_email = $user->getEmail(); | ||
| $this->user_fullname = $user->getFullName(); | ||
| $this->profile_url = URL::action('UserController@getProfile'); | ||
| } | ||
|
|
||
| /** | ||
| * @return $this | ||
| */ | ||
| public function build() | ||
| { | ||
| $this->subject = sprintf('[%s] Two-factor authentication enabled', Config::get('app.app_name')); | ||
| Log::debug(sprintf("TwoFactorEnabledByAdminMail::build to %s", $this->user_email)); | ||
| return $this->from(Config::get("mail.from")) | ||
| ->to($this->user_email) | ||
| ->subject($this->subject) | ||
| ->view('emails.auth.two_factor_enabled_by_admin'); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.