~jan0sch/smederee

Showing details for patch 870865668db922dc3b53d704f5e0f981051441ea.
2022-07-13 (Wed), 2:29 PM - Jens Grassel - 870865668db922dc3b53d704f5e0f981051441ea

Welcome page for signed up users.

Summary of changes
1 files added
  • modules/hub/src/main/twirl/de/smederee/hub/views/welcome.scala.html
1 files modified with 10 lines added and 2 lines removed
  • modules/hub/src/main/scala/de/smederee/hub/SignupRoutes.scala with 10 added and 2 removed lines
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRoutes.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRoutes.scala	2025-02-03 05:10:17.307775011 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRoutes.scala	2025-02-03 05:10:17.307775011 +0000
@@ -110,7 +110,7 @@
                   hash     <- Sync[F].delay(signupForm.password.encode)
                   _        <- Sync[F].delay(log.info(s"Going to create account for ${account.name}."))
                   _        <- repo.createAccount(account, PasswordHash(hash))
-                  redirect <- Ok("FIXME") // FIXME
+                  redirect <- SeeOther.apply(Location(signupPath.addPath("welcome")))
                 } yield redirect
             }
         }
@@ -136,7 +136,15 @@
       SeeOther.apply(Location(Uri(path = Uri.Path.Root))) // Redirect already logged in users.
   }
 
+  private val showWelcomePage: HttpRoutes[F] = HttpRoutes.of {
+    case req @ GET -> Root / "signup" / "welcome" =>
+      for {
+        csrf <- Sync[F].delay(req.getCsrfToken)
+        resp <- Ok(views.html.welcome()(csrf, "Thank you and welcome!".some))
+      } yield resp
+  }
+
   val protectedRoutes = showSignUpFormForLoggedInUsers <+> parseSignUpFormForLoggedInUsers
 
-  val routes = showSignUpForm <+> parseSignUpForm
+  val routes = showSignUpForm <+> parseSignUpForm <+> showWelcomePage
 }
diff -rN -u old-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/welcome.scala.html new-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/welcome.scala.html
--- old-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/welcome.scala.html	1970-01-01 00:00:00.000000000 +0000
+++ new-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/welcome.scala.html	2025-02-03 05:10:17.311775018 +0000
@@ -0,0 +1,12 @@
+@(lang: LanguageCode = LanguageCode("en"), pathPrefix: Option[Uri] = None)(csrf: Option[CsrfToken] = None, title: Option[String] = None)
+@main(lang, pathPrefix)()(csrf, title) {
+@defining(lang.toLocale) { implicit locale =>
+  <div class="content">
+    <div class="pure-g">
+      <div class="pure-u-1-1 pure-u-md-1-1">
+        <h2 class="content-head is-center">Thank you and welcome!</h2>
+      </div>
+    </div>
+  </div>
+}
+}