MT#53706 OTP: reset show_info with jwt login

Change-Id: Id2f76dca12b1b0242de6d0ab763ce2bde885f747
mr13.3
Rene Krenn 4 weeks ago
parent ded0cf51c6
commit f167a55a2f

@ -744,14 +744,19 @@ sub login_jwt :Chained('/') :PathPart('login_jwt') :Args(0) :Method('POST') {
$c->log->info("User not found"); $c->log->info("User not found");
return; return;
} }
if ($auth_user->enable_2fa if ($auth_user->enable_2fa) {
and not NGCP::Panel::Utils::Auth::verify_otp($c,$auth_user->otp_secret,$otp,time())) { if (NGCP::Panel::Utils::Auth::verify_otp($c,$auth_user->otp_secret,$otp,time())) {
$c->response->status(HTTP_FORBIDDEN); $auth_user->update({
$c->response->body(encode_json({ show_otp_registration_info => 0,
code => HTTP_FORBIDDEN, }) if ($auth_user->show_otp_registration_info);
message => "Invalid OTP" })."\n"); } else {
$c->log->info("Invalid OTP"); $c->response->status(HTTP_FORBIDDEN);
return; $c->response->body(encode_json({
code => HTTP_FORBIDDEN,
message => "Invalid OTP" })."\n");
$c->log->info("Invalid OTP");
return;
}
} }
} }
} else { } else {

Loading…
Cancel
Save