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

View file

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

View file

@ -112,6 +112,7 @@ pub async fn sign_up_post(
email: form_data.email.clone(), email: form_data.email.clone(),
message_email: match error { message_email: match error {
SignUpError::InvalidEmail => context.tr.t(Sentence::InvalidEmail), SignUpError::InvalidEmail => context.tr.t(Sentence::InvalidEmail),
SignUpError::UserAlreadyExists => context.tr.t(Sentence::EmailAlreadyTaken),
_ => "", _ => "",
}, },
message_password: match error { message_password: match error {
@ -120,8 +121,7 @@ pub async fn sign_up_post(
_ => "", _ => "",
}, },
message: match error { message: match error {
SignUpError::UserAlreadyExists => context.tr.t(Sentence::EmailAlreadyTaken), // The error details is not shown to the user (it is logged above).
// The error is not shown to the user (it is logged above).
SignUpError::DatabaseError(_) => context.tr.t(Sentence::DatabaseError), SignUpError::DatabaseError(_) => context.tr.t(Sentence::DatabaseError),
SignUpError::UnableToSendEmail(_) => context.tr.t(Sentence::UnableToSendEmail), 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> <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"> <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> <label for="input-password-2">{{ context.tr.t(Sentence::ReEnterPassword) }}</label>
<input id="input-password-2" type="password" name="password_2" autocomplete="new-password"> <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> <label for="input-servings">{{ context.tr.t(Sentence::ProfileDefaultServings) }}</label>
<input <input

View file

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

View file

@ -2,7 +2,7 @@
<div id="toasts"> <div id="toasts">
<div class="toast"> <div class="toast">
<img class="icon" width="24" height="24" alt="icon" src=""> <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> <span class="close button"></span>
</div> </div>
</div> </div>