vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

commit aa5a05960ed504de9df41c58d454467c132c00bf
parent 638766b346dc0e00c5db7935d21e48354d632335
Author: Stefan Melmuk <stefan.melmuk@gmail.com>
Date:   Thu,  6 Oct 2022 00:18:20 +0200

allow registration without invite link

if signups are allowed invited users should be able to complete their
registration even when they don't have the invite link at hand.

Diffstat:
Msrc/api/core/accounts.rs | 12++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/api/core/accounts.rs b/src/api/core/accounts.rs @@ -101,11 +101,7 @@ async fn register(data: JsonUpcase<RegisterData>, conn: DbConn) -> JsonResult { let mut user = match User::find_by_mail(&email, &conn).await { Some(user) => { if !user.password_hash.is_empty() { - if CONFIG.is_signup_allowed(&email) { - err!("User already exists") - } else { - err!("Registration not allowed or user already exists") - } + err!("Registration not allowed or user already exists") } if let Some(token) = data.Token { @@ -121,10 +117,10 @@ async fn register(data: JsonUpcase<RegisterData>, conn: DbConn) -> JsonResult { user_org.save(&conn).await?; } user - } else if EmergencyAccess::find_invited_by_grantee_email(&email, &conn).await.is_some() { + } else if CONFIG.is_signup_allowed(&email) + || EmergencyAccess::find_invited_by_grantee_email(&email, &conn).await.is_some() + { user - } else if CONFIG.is_signup_allowed(&email) { - err!("Account with this email already exists") } else { err!("Registration not allowed or user already exists") }