mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2024-11-22 10:52:40 +01:00
Add 2FA icon to admin panel
This commit is contained in:
parent
a1dc47b826
commit
700e084101
@ -151,10 +151,7 @@ fn twofactor_auth(
|
|||||||
device: &mut Device,
|
device: &mut Device,
|
||||||
conn: &DbConn,
|
conn: &DbConn,
|
||||||
) -> ApiResult<Option<String>> {
|
) -> ApiResult<Option<String>> {
|
||||||
let twofactors_raw = TwoFactor::find_by_user(user_uuid, conn);
|
let twofactors = TwoFactor::find_by_user(user_uuid, conn);
|
||||||
// Remove u2f challenge twofactors (impl detail)
|
|
||||||
let twofactors: Vec<_> = twofactors_raw.iter().filter(|tf| tf.type_ < 1000).collect();
|
|
||||||
|
|
||||||
let providers: Vec<_> = twofactors.iter().map(|tf| tf.type_).collect();
|
let providers: Vec<_> = twofactors.iter().map(|tf| tf.type_).collect();
|
||||||
|
|
||||||
// No twofactor token if twofactor is disabled
|
// No twofactor token if twofactor is disabled
|
||||||
|
@ -100,6 +100,7 @@ impl TwoFactor {
|
|||||||
pub fn find_by_user(user_uuid: &str, conn: &DbConn) -> Vec<Self> {
|
pub fn find_by_user(user_uuid: &str, conn: &DbConn) -> Vec<Self> {
|
||||||
twofactor::table
|
twofactor::table
|
||||||
.filter(twofactor::user_uuid.eq(user_uuid))
|
.filter(twofactor::user_uuid.eq(user_uuid))
|
||||||
|
.filter(twofactor::type_.lt(1000)) // Filter implementation types
|
||||||
.load::<Self>(&**conn)
|
.load::<Self>(&**conn)
|
||||||
.expect("Error loading twofactor")
|
.expect("Error loading twofactor")
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ pub fn send_invite_confirmed(address: &str, org_name: &str, config: &MailConfig)
|
|||||||
fn send_email(address: &str, subject: &str, body: &str, config: &MailConfig) -> EmptyResult {
|
fn send_email(address: &str, subject: &str, body: &str, config: &MailConfig) -> EmptyResult {
|
||||||
let email = EmailBuilder::new()
|
let email = EmailBuilder::new()
|
||||||
.to(address)
|
.to(address)
|
||||||
.from((config.smtp_from.clone(), config.smtp_from_name.clone()))
|
.from((config.smtp_from.as_str(), config.smtp_from_name.as_str()))
|
||||||
.subject(subject)
|
.subject(subject)
|
||||||
.header(("Content-Type", "text/html"))
|
.header(("Content-Type", "text/html"))
|
||||||
.body(body)
|
.body(body)
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
<div class="row justify-content-between">
|
<div class="row justify-content-between">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<strong>{{Name}}</strong>
|
<strong>{{Name}}</strong>
|
||||||
|
{{#if TwoFactorEnabled}}
|
||||||
|
<span class="badge badge-success ml-2">2FA</span>
|
||||||
|
{{/if}}
|
||||||
<span class="d-block">{{Email}}</span>
|
<span class="d-block">{{Email}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
Loading…
Reference in New Issue
Block a user