Little changes on forms presentation

This commit is contained in:
Greg Burri 2025-05-07 13:38:01 +02:00
parent 3ab168fd67
commit fcadaf855f
6 changed files with 15 additions and 44 deletions

View file

@ -27,7 +27,7 @@ body {
margin: 0px;
.user-message {
font-weight: bold;
font-weight: 600;
color: consts.$color-highlight;
}
@ -256,46 +256,16 @@ body {
form {
display: grid;
grid-template-columns: auto 1fr;
gap: 3px;
input,
button {
border-width: 1px;
}
}
#sign-up form {
display: grid;
grid-template-columns: auto 1fr auto;
input[type="submit"] {
grid-column: 2
}
}
#sign-in form {
input[type="submit"] {
grid-column: 2
}
}
#ask-reset-password form {
grid-template-columns: auto 1fr auto;
input[type="submit"] {
grid-column: 2
}
}
#reset-password form {
grid-template-columns: auto 1fr auto;
input[type="submit"] {
grid-column: 2
}
gap: calc(consts.$margin / 2);
align-items: center;
}
#sign-up form,
#sign-in form,
#ask-reset-password form,
#reset-password form,
#user-edit form {
// <label> <input> <user message>.
grid-template-columns: auto 1fr auto;
input[type="submit"] {

View file

@ -8,7 +8,6 @@ use crate::{
consts,
data::model,
hash::{hash, verify_password},
services::user,
};
#[derive(Debug, Display)]

View file

@ -112,6 +112,7 @@ pub async fn sign_up_post(
email: form_data.email.clone(),
message_email: match error {
SignUpError::InvalidEmail => context.tr.t(Sentence::InvalidEmail),
SignUpError::UserAlreadyExists => context.tr.t(Sentence::EmailAlreadyTaken),
_ => "",
},
message_password: match error {
@ -120,8 +121,7 @@ pub async fn sign_up_post(
_ => "",
},
message: match error {
SignUpError::UserAlreadyExists => context.tr.t(Sentence::EmailAlreadyTaken),
// The error is not shown to the user (it is logged above).
// The error details is not shown to the user (it is logged above).
SignUpError::DatabaseError(_) => context.tr.t(Sentence::DatabaseError),
SignUpError::UnableToSendEmail(_) => context.tr.t(Sentence::UnableToSendEmail),
_ => "",

View file

@ -28,11 +28,11 @@
<label for="input-password-1">{{ context.tr.tp(Sentence::ProfileNewPassword, [Box::new(common::consts::MIN_PASSWORD_SIZE)]) }}</label>
<input id="input-password-1" type="password" name="password_1" autocomplete="new-password">
<span></span>
<span class="user-message">{{ message_password }}</span>
<label for="input-password-2">{{ context.tr.t(Sentence::ReEnterPassword) }}</label>
<input id="input-password-2" type="password" name="password_2" autocomplete="new-password">
<span class="user-message">{{ message_password }}</span>
<span></span>
<label for="input-servings">{{ context.tr.t(Sentence::ProfileDefaultServings) }}</label>
<input

View file

@ -10,9 +10,11 @@
<label for="input-email">{{ context.tr.t(Sentence::EmailAddress) }}</label>
<input id="input-email" type="email" name="email" value="{{ email }}"
autocapitalize="none" autocomplete="email" autofocus="autofocus">
<span></span>
<label for="input-password">{{ context.tr.t(Sentence::Password) }}</label>
<input id="input-password" type="password" name="password" autocomplete="current-password">
<span></span>
<input type="submit" value="{{ context.tr.t(Sentence::SignInMenu) }}">
</form>

View file

@ -2,7 +2,7 @@
<div id="toasts">
<div class="toast">
<img class="icon" width="24" height="24" alt="icon" src="">
<div class="content"></div>
<div class="content user-message"></div>
<span class="close button"></span>
</div>
</div>