mirror of
https://github.com/dani-garcia/vaultwarden
synced 2024-11-22 20:03:19 +00:00
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.
This commit is contained in:
parent
638766b346
commit
aa5a05960e
1 changed files with 4 additions and 8 deletions
|
@ -101,11 +101,7 @@ async fn register(data: JsonUpcase<RegisterData>, conn: DbConn) -> JsonResult {
|
||||||
let mut user = match User::find_by_mail(&email, &conn).await {
|
let mut user = match User::find_by_mail(&email, &conn).await {
|
||||||
Some(user) => {
|
Some(user) => {
|
||||||
if !user.password_hash.is_empty() {
|
if !user.password_hash.is_empty() {
|
||||||
if CONFIG.is_signup_allowed(&email) {
|
err!("Registration not allowed or user already exists")
|
||||||
err!("User already exists")
|
|
||||||
} else {
|
|
||||||
err!("Registration not allowed or user already exists")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(token) = data.Token {
|
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_org.save(&conn).await?;
|
||||||
}
|
}
|
||||||
user
|
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
|
user
|
||||||
} else if CONFIG.is_signup_allowed(&email) {
|
|
||||||
err!("Account with this email already exists")
|
|
||||||
} else {
|
} else {
|
||||||
err!("Registration not allowed or user already exists")
|
err!("Registration not allowed or user already exists")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue