Skip to content

Instantly share code, notes, and snippets.

View rober-m's full-sized avatar

Robertino rober-m

View GitHub Profile
@rober-m
rober-m / Web-Controller-Users.hs
Last active September 16, 2023 09:53
Create user in IHP
-- Web/Controller/Users.hs
action CreateUserAction = do
let user = newRecord @User
-- Get the value from the password confirmation input field.
let passwordConfirmation = param @Text "passwordConfirmation"
user
|> fill @["email", "passwordHash"]
-- We ensure that the error message doesn't include
-- the entered password.
|> validateField #passwordHash (isEqual passwordConfirmation |> withCustomErrorMessage "Passwords don't match")
@rober-m
rober-m / Web-View-Sessions-New.hs
Last active September 15, 2023 19:32
Login view for blogging project of Haskell Web lesson
module Web.View.Sessions.New where
import IHP.AuthSupport.View.Sessions.New
import Web.View.Prelude
instance View (NewView User) where
html NewView { .. } = [hsx|
<div class="h-100" id="sessions-new">
<div class="d-flex align-items-center">
<div class="w-100">