Allow users to migrate from level 0 to 1
This commit is contained in:
parent
78c3443a92
commit
33070b62f1
18
src/user.rs
18
src/user.rs
|
@ -449,11 +449,11 @@ impl User {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Can we level up the main credential?
|
// Can we level up the main credential?
|
||||||
let can_level_up = reachcred.is_some()
|
let can_level_up = level == 0
|
||||||
&& (level == 0
|
|
||||||
&& eligible_for_trust_promotion(&config.la_net, &self.primary_cred).await
|
&& eligible_for_trust_promotion(&config.la_net, &self.primary_cred).await
|
||||||
|| level > 0
|
|| reachcred.is_some()
|
||||||
&& eligible_for_level_up(&config.la_net, &self.primary_cred).await);
|
&& level > 0
|
||||||
|
&& eligible_for_level_up(&config.la_net, &self.primary_cred).await;
|
||||||
|
|
||||||
// Can we migrate the main credential?
|
// Can we migrate the main credential?
|
||||||
let can_migrate = reachcred.is_none() && level >= MIN_TRUST_LEVEL;
|
let can_migrate = reachcred.is_none() && level >= MIN_TRUST_LEVEL;
|
||||||
|
@ -608,8 +608,6 @@ impl User {
|
||||||
// let's just allow it.
|
// let's just allow it.
|
||||||
|
|
||||||
if can_level_up {
|
if can_level_up {
|
||||||
// If we can level up/trust migrate, do so
|
|
||||||
|
|
||||||
// Trust migration from level 0 to level 1
|
// Trust migration from level 0 to level 1
|
||||||
let cred = if level == 0 {
|
let cred = if level == 0 {
|
||||||
trust_migration(
|
trust_migration(
|
||||||
|
@ -653,6 +651,7 @@ impl User {
|
||||||
get_migration_pub(&config.la_pubkeys),
|
get_migration_pub(&config.la_pubkeys),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
self.primary_cred = cred;
|
self.primary_cred = cred;
|
||||||
self.secondary_cred = None;
|
self.secondary_cred = None;
|
||||||
} else if second_level_up {
|
} else if second_level_up {
|
||||||
|
@ -672,6 +671,7 @@ impl User {
|
||||||
get_migration_pub(&config.la_pubkeys),
|
get_migration_pub(&config.la_pubkeys),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
self.primary_cred = cred;
|
self.primary_cred = cred;
|
||||||
self.secondary_cred = None;
|
self.secondary_cred = None;
|
||||||
} else if second_cred.is_some() {
|
} else if second_cred.is_some() {
|
||||||
|
@ -783,9 +783,10 @@ impl User {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Censor user tries to level up their primary credential
|
// Censor user tries to level up their primary credential
|
||||||
if reachcred.is_some() {
|
|
||||||
if level == 0 && eligible_for_trust_promotion(&config.la_net, &self.primary_cred).await
|
if level == 0 && eligible_for_trust_promotion(&config.la_net, &self.primary_cred).await
|
||||||
|| level > 0 && eligible_for_level_up(&config.la_net, &self.primary_cred).await
|
|| reachcred.is_some()
|
||||||
|
&& level > 0
|
||||||
|
&& eligible_for_level_up(&config.la_net, &self.primary_cred).await
|
||||||
{
|
{
|
||||||
let new_cred = if level == 0 {
|
let new_cred = if level == 0 {
|
||||||
trust_migration(
|
trust_migration(
|
||||||
|
@ -834,7 +835,6 @@ impl User {
|
||||||
censor.give_lox_cred(&fingerprint, &self.primary_cred, false);
|
censor.give_lox_cred(&fingerprint, &self.primary_cred, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// LA has identified this bucket as blocked. This change
|
// LA has identified this bucket as blocked. This change
|
||||||
// will not be reverted, so either migrate or replace the
|
// will not be reverted, so either migrate or replace the
|
||||||
|
|
Loading…
Reference in New Issue