wip: currently rewriting the project as a full stack application tangled.org/kacaii.dev/sigo
gleam
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

:loud_sound: log when an user successfully log in

Kacaii 90af4672 452aa260

+17 -1
+14 -1
src/app/routes/login.gleam
··· 5 5 import gleam/list 6 6 import gleam/result 7 7 import gleam/string 8 + import glight 8 9 import pog 9 10 import wisp 10 11 import youid/uuid 11 12 12 - const cookie_name = "user_id" 13 + const cookie_name = "USER_ID" 13 14 14 15 type LogIn { 15 16 LogIn(registration: String, password: String) ··· 42 43 let login_result = get_login_token(login: login_data, ctx:) 43 44 case login_result { 44 45 Ok(user_uuid) -> { 46 + //  Logs user registration 47 + log_login(login_data) 48 + 49 + //  Store UUID cookie 45 50 wisp.set_cookie( 46 51 response: wisp.ok(), 47 52 request: request, ··· 114 119 } 115 120 } 116 121 } 122 + } 123 + 124 + fn log_login(login: LogIn) -> Nil { 125 + glight.logger() 126 + |> glight.with("registration", login.registration) 127 + |> glight.info("login") 128 + 129 + glight.set_log_level(glight.Debug) 117 130 } 118 131 119 132 /// Login can fail
+3
src/app/routes/signup.gleam
··· 62 62 Ok(signup) -> { 63 63 case try_insert_into_database(signup:, ctx:) { 64 64 Ok(_) -> { 65 + //  Logs new user account 65 66 log_signup(signup) 67 + 68 + // 󱅡 All good! 66 69 wisp.created() 67 70 |> wisp.set_body(wisp.Text("Cadastro realizado com sucesso")) 68 71 }