{master} ensure confirmation email is sent
parent
825e742fdd
commit
f8a49fa397
|
@ -429,7 +429,7 @@ object Auth extends LilaController {
|
|||
} { data =>
|
||||
HasherRateLimit(user.username, ctx.req) { _ =>
|
||||
Env.user.authenticator.setPassword(user.id, ClearPassword(data.newPasswd1)) >>
|
||||
UserRepo.setEmailConfirmed(user.id) >>
|
||||
UserRepo.setEmailConfirmed(user.id).flatMap { _ ?? { e => welcome(user, e) } } >>
|
||||
UserRepo.disableTwoFactor(user.id) >>
|
||||
env.store.disconnect(user.id) >>
|
||||
Env.push.webSubscriptionApi.unsubscribeByUser(user) >>
|
||||
|
|
|
@ -19,7 +19,7 @@ object EmailConfirmSkip extends EmailConfirm {
|
|||
|
||||
def effective = false
|
||||
|
||||
def send(user: User, email: EmailAddress)(implicit lang: Lang) = UserRepo setEmailConfirmed user.id
|
||||
def send(user: User, email: EmailAddress)(implicit lang: Lang) = UserRepo setEmailConfirmed user.id void
|
||||
|
||||
def confirm(token: String): Fu[EmailConfirm.Result] = fuccess(EmailConfirm.Result.NotFound)
|
||||
}
|
||||
|
|
|
@ -508,8 +508,10 @@ object UserRepo {
|
|||
def mustConfirmEmail(id: User.ID): Fu[Boolean] =
|
||||
coll.exists($id(id) ++ $doc(F.mustConfirmEmail $exists true))
|
||||
|
||||
def setEmailConfirmed(id: User.ID): Funit =
|
||||
coll.update($id(id) ++ $doc(F.mustConfirmEmail $exists true), $unset(F.mustConfirmEmail)).void
|
||||
def setEmailConfirmed(id: User.ID): Fu[Option[EmailAddress]] =
|
||||
coll.update($id(id) ++ $doc(F.mustConfirmEmail $exists true), $unset(F.mustConfirmEmail)) flatMap { res =>
|
||||
(res.nModified == 1) ?? email(id)
|
||||
}
|
||||
|
||||
def speaker(id: User.ID): Fu[Option[User.Speaker]] = {
|
||||
import User.speakerHandler
|
||||
|
|
Loading…
Reference in New Issue