1
0
Fork 0

Implemented PUT for /two-factor/authenticator and /two-factor/disable

Dieser Commit ist enthalten in:
Kumar Ankur 2018-08-10 23:19:07 +05:30
Ursprung ddda86b90d
Commit 5f6d721c09
2 geänderte Dateien mit 20 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -66,8 +66,10 @@ pub fn routes() -> Vec<Route> {
get_recover, get_recover,
recover, recover,
disable_twofactor, disable_twofactor,
disable_twofactor_put,
generate_authenticator, generate_authenticator,
activate_authenticator, activate_authenticator,
activate_authenticator_put,
generate_u2f, generate_u2f,
activate_u2f, activate_u2f,

Datei anzeigen

@ -112,6 +112,15 @@ fn disable_twofactor(
}))) })))
} }
#[put("/two-factor/disable", data = "<data>")]
fn disable_twofactor_put(
data: JsonUpcase<DisableTwoFactorData>,
headers: Headers,
conn: DbConn,
) -> JsonResult {
disable_twofactor(data, headers, conn)
}
#[post("/two-factor/get-authenticator", data = "<data>")] #[post("/two-factor/get-authenticator", data = "<data>")]
fn generate_authenticator( fn generate_authenticator(
data: JsonUpcase<PasswordData>, data: JsonUpcase<PasswordData>,
@ -194,6 +203,15 @@ fn activate_authenticator(
}))) })))
} }
#[put("/two-factor/authenticator", data = "<data>")]
fn activate_authenticator_put(
data: JsonUpcase<EnableAuthenticatorData>,
headers: Headers,
conn: DbConn,
) -> JsonResult {
activate_authenticator(data, headers, conn)
}
fn _generate_recover_code(user: &mut User, conn: &DbConn) { fn _generate_recover_code(user: &mut User, conn: &DbConn) {
if user.totp_recover.is_none() { if user.totp_recover.is_none() {
let totp_recover = BASE32.encode(&crypto::get_random(vec![0u8; 20])); let totp_recover = BASE32.encode(&crypto::get_random(vec![0u8; 20]));