Need to perform 2FA before modifying factors
This commit is contained in:
@ -9,6 +9,7 @@ use qrcode_generator::QrCodeEcc;
|
||||
use crate::constants::MAX_SECOND_FACTOR_NAME_LEN;
|
||||
use crate::controllers::settings_controller::BaseSettingsPage;
|
||||
use crate::data::app_config::AppConfig;
|
||||
use crate::data::critical_route::CriticalRoute;
|
||||
use crate::data::current_user::CurrentUser;
|
||||
use crate::data::totp_key::TotpKey;
|
||||
use crate::data::user::User;
|
||||
@ -43,7 +44,7 @@ struct AddWebauhtnPage<'a> {
|
||||
}
|
||||
|
||||
/// Manage two factors authentication methods route
|
||||
pub async fn two_factors_route(user: CurrentUser) -> impl Responder {
|
||||
pub async fn two_factors_route(_critical: CriticalRoute, user: CurrentUser) -> impl Responder {
|
||||
HttpResponse::Ok().body(
|
||||
TwoFactorsPage {
|
||||
p: BaseSettingsPage::get("Two factor auth", &user, None, None),
|
||||
@ -56,7 +57,7 @@ pub async fn two_factors_route(user: CurrentUser) -> impl Responder {
|
||||
}
|
||||
|
||||
/// Configure a new TOTP authentication factor
|
||||
pub async fn add_totp_factor_route(user: CurrentUser) -> impl Responder {
|
||||
pub async fn add_totp_factor_route(_critical: CriticalRoute, user: CurrentUser) -> impl Responder {
|
||||
let key = TotpKey::new_random();
|
||||
|
||||
let qr_code = qrcode_generator::to_png_to_vec(
|
||||
@ -87,6 +88,7 @@ pub async fn add_totp_factor_route(user: CurrentUser) -> impl Responder {
|
||||
|
||||
/// Configure a new security key factor
|
||||
pub async fn add_webauthn_factor_route(
|
||||
_critical: CriticalRoute,
|
||||
user: CurrentUser,
|
||||
manager: WebAuthManagerReq,
|
||||
) -> impl Responder {
|
||||
|
Reference in New Issue
Block a user