Skip to content

Commit

Permalink
Remind users without emails to set one every 10 days.
Browse files Browse the repository at this point in the history
Only reminding users to set an email at log-in (lichess-org#14094) had no effects, most probably because users stay logged-in for a very long time.
  • Loading branch information
kraktus committed Feb 3, 2024
1 parent 563e002 commit 63be933
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/http/KeyPages.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ final class KeyPages(val env: Env)(using Executor)
.mon(_.lobby segment "preloader.total")
.flatMap: h =>
ctx.me.filter(_.hasTitle).foreach(env.msg.twoFactorReminder(_))
ctx.me.filterNot(_.hasEmail).foreach(env.msg.emailReminder(_))
renderPage:
lila.mon.chronoSync(_.lobby segment "renderSync"):
html.lobby.home(h)
Expand Down
6 changes: 4 additions & 2 deletions modules/user/src/main/User.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ case class User(
plan: Plan,
flair: Option[Flair] = None,
totpSecret: Option[TotpSecret] = None,
marks: UserMarks = UserMarks.empty
marks: UserMarks = UserMarks.empty,
hasEmail: Boolean
):

override def equals(other: Any) = other match
Expand Down Expand Up @@ -310,7 +311,8 @@ object User:
plan = r.getO[Plan](plan) | Plan.empty,
totpSecret = r.getO[TotpSecret](totpSecret),
flair = r.getO[Flair](flair).filter(FlairApi.exists),
marks = r.getO[UserMarks](marks) | UserMarks.empty
marks = r.getO[UserMarks](marks) | UserMarks.empty,
hasEmail = r.getO[EmailAddress](email).isDefined
)

def writes(w: BSON.Writer, o: User) =
Expand Down

0 comments on commit 63be933

Please sign in to comment.