pricing login modal : added password strength description, and lost password link

This commit is contained in:
Bachir Soussi Chiadmi 2021-01-12 10:17:49 +01:00
parent 02c983e7e0
commit efd88d298b
5 changed files with 33 additions and 9 deletions

View File

@ -7,6 +7,8 @@
use \Drupal\Core\Form\FormStateInterface; use \Drupal\Core\Form\FormStateInterface;
use \Drupal\Core\Block\BlockPluginInterface; use \Drupal\Core\Block\BlockPluginInterface;
use \Drupal\Core\Url;
use \Drupal\Core\Link;
/** /**
* implements hook_form_FORM_ID_alter() * implements hook_form_FORM_ID_alter()
@ -24,6 +26,10 @@ function materio_user_form_user_login_form_alter(&$form, FormStateInterface $for
"@keyup.enter" => "login" "@keyup.enter" => "login"
); );
$url = Url::fromRoute('user.pass');
$form['pass']['#description'] = Link::fromTextAndUrl('Forgot your password?', $url)->toString();
// "<a href="{{ path('user.pass') }}">{{ 'Forgot your password?'|t }}</a>";
$form['actions']['submit']['#attributes'] = array( $form['actions']['submit']['#attributes'] = array(
"@click.prevent" => "login" "@click.prevent" => "login"
); );
@ -59,6 +65,7 @@ function materio_user_form_user_modal_form_alter(&$form, FormStateInterface $for
function _materio_user_process_password_confirm($element){ function _materio_user_process_password_confirm($element){
// ksm($element); // ksm($element);
$element['pass1']['#description'] = t('Password must contains Lowercase and Uppercase Letters, numbers, and punctuation.');
$element['pass1']['#attributes'] += array( $element['pass1']['#attributes'] += array(
"v-model" => "pass1", "v-model" => "pass1",
"placeholder" => $element['pass1']['#title'], "placeholder" => $element['pass1']['#title'],

View File

@ -2251,6 +2251,11 @@ article.card {
#pricing-modal-login-register #login-register > section form input[type="email"], #pricing-modal-login-register #login-register > section form input[type="email"],
#pricing-modal-login-register #login-register > section form input[type="password"] { #pricing-modal-login-register #login-register > section form input[type="password"] {
max-width: 11em; } max-width: 11em; }
#pricing-modal-login-register #login-register > section form#user-login-form #edit-pass--description,
#pricing-modal-login-register #login-register > section form #edit-pass-pass1--description {
display: block;
max-width: 16em;
font-size: 0.693em; }
#main-content form.commerce-checkout-flow { #main-content form.commerce-checkout-flow {
max-width: 641px; } max-width: 641px; }

File diff suppressed because one or more lines are too long

View File

@ -1469,6 +1469,12 @@ article.card{
input[type="password"]{ input[type="password"]{
max-width: 11em; max-width: 11em;
} }
&#user-login-form #edit-pass--description,
#edit-pass-pass1--description{
display: block;
max-width: 16em;
font-size: 0.693em;
}
} }
} }
section.login{ section.login{

View File

@ -129,7 +129,9 @@ export default {
}, },
userLogin ({ dispatch, state }, credentials) { userLogin ({ dispatch, state }, credentials) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
dispatch('getToken', credentials).then(() => { dispatch('getToken', credentials)
// TODO: catch failed login
.then(() => {
dispatch('getUser').then(userdata => { dispatch('getUser').then(userdata => {
console.log('User Loggedin') console.log('User Loggedin')
if (state.isAdmin) { if (state.isAdmin) {
@ -138,6 +140,10 @@ export default {
resolve() resolve()
}) })
}) })
.catch(error => {
console.warn('Issue with Dispatch getToken', error)
Promise.reject(error)
})
}) })
}, },
getToken ({ dispatch, commit, state }, credentials) { getToken ({ dispatch, commit, state }, credentials) {