added login failed message (remains register message); installed flood_control contrib module
This commit is contained in:
parent
584c4cc5d2
commit
e65dfeb5b5
|
@ -46,6 +46,7 @@
|
||||||
"drupal/field_group": "3.x-dev@dev",
|
"drupal/field_group": "3.x-dev@dev",
|
||||||
"drupal/field_permissions": "^1.0",
|
"drupal/field_permissions": "^1.0",
|
||||||
"drupal/flag_lists": "^4.0@beta",
|
"drupal/flag_lists": "^4.0@beta",
|
||||||
|
"drupal/flood_control": "^2.1",
|
||||||
"drupal/genpass": "^1.x-dev",
|
"drupal/genpass": "^1.x-dev",
|
||||||
"drupal/graphql": "4.x-dev@dev",
|
"drupal/graphql": "4.x-dev@dev",
|
||||||
"drupal/image_delta_formatter": "^1.x-dev",
|
"drupal/image_delta_formatter": "^1.x-dev",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "4bfbf0626a4aa7d6c658e5482a8259ac",
|
"content-hash": "350fc178a837b5226811e5f48aeff358",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "alchemy/zippy",
|
"name": "alchemy/zippy",
|
||||||
|
@ -7488,6 +7488,58 @@
|
||||||
"issues": "https://www.drupal.org/project/issues/flag_lists"
|
"issues": "https://www.drupal.org/project/issues/flag_lists"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "drupal/flood_control",
|
||||||
|
"version": "2.1.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.drupalcode.org/project/flood_control.git",
|
||||||
|
"reference": "2.1.1"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://ftp.drupal.org/files/projects/flood_control-2.1.1.zip",
|
||||||
|
"reference": "2.1.1",
|
||||||
|
"shasum": "b8384e1673b92b0bdd8630624528c32fb7ef5f54"
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"drupal/core": "^8 || ^9"
|
||||||
|
},
|
||||||
|
"type": "drupal-module",
|
||||||
|
"extra": {
|
||||||
|
"drupal": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"datestamp": "1609933716",
|
||||||
|
"security-coverage": {
|
||||||
|
"status": "covered",
|
||||||
|
"message": "Covered by Drupal's security advisory policy"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packages.drupal.org/8/downloads",
|
||||||
|
"license": [
|
||||||
|
"GPL-2.0-or-later"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Dave Reid",
|
||||||
|
"homepage": "https://www.drupal.org/user/53892"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "batigolix",
|
||||||
|
"homepage": "https://www.drupal.org/user/22175"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fabianderijk",
|
||||||
|
"homepage": "https://www.drupal.org/user/278745"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Allows configuring hidden flood control options and unblocking IP addresses and user ID's that are blocked after multiple failed login attempts.",
|
||||||
|
"homepage": "https://www.drupal.org/project/flood_control",
|
||||||
|
"support": {
|
||||||
|
"source": "https://git.drupalcode.org/project/flood_control"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "drupal/genpass",
|
"name": "drupal/genpass",
|
||||||
"version": "dev-1.x",
|
"version": "dev-1.x",
|
||||||
|
|
|
@ -83,6 +83,7 @@ module:
|
||||||
filter_perms: 0
|
filter_perms: 0
|
||||||
flag: 0
|
flag: 0
|
||||||
flag_lists: 0
|
flag_lists: 0
|
||||||
|
flood_control: 0
|
||||||
genpass: 0
|
genpass: 0
|
||||||
graphql: 0
|
graphql: 0
|
||||||
help: 0
|
help: 0
|
||||||
|
|
|
@ -23,6 +23,7 @@ negotiation:
|
||||||
language-url-fallback: 1
|
language-url-fallback: 1
|
||||||
language_interface:
|
language_interface:
|
||||||
enabled:
|
enabled:
|
||||||
|
language-graphql-operation: -999
|
||||||
language-url: -20
|
language-url: -20
|
||||||
language-browser: -18
|
language-browser: -18
|
||||||
language-selected: -17
|
language-selected: -17
|
||||||
|
|
|
@ -47,6 +47,9 @@ third_party_settings:
|
||||||
index_prefix: ''
|
index_prefix: ''
|
||||||
collection: ''
|
collection: ''
|
||||||
timezone: ''
|
timezone: ''
|
||||||
|
term_modifiers:
|
||||||
|
slop: 10000000
|
||||||
|
fuzzy: 2
|
||||||
id: autocomplete
|
id: autocomplete
|
||||||
name: 'autocomplete taxonomy'
|
name: 'autocomplete taxonomy'
|
||||||
description: ''
|
description: ''
|
||||||
|
|
|
@ -43,6 +43,9 @@ third_party_settings:
|
||||||
fragsize: 0
|
fragsize: 0
|
||||||
advanced:
|
advanced:
|
||||||
index_prefix: ''
|
index_prefix: ''
|
||||||
|
term_modifiers:
|
||||||
|
slop: 10000000
|
||||||
|
fuzzy: 2
|
||||||
id: database
|
id: database
|
||||||
name: database
|
name: database
|
||||||
description: ''
|
description: ''
|
||||||
|
|
|
@ -49,6 +49,7 @@ backend_config:
|
||||||
http_method: AUTO
|
http_method: AUTO
|
||||||
jmx: false
|
jmx: false
|
||||||
solr_install_dir: ../../..
|
solr_install_dir: ../../..
|
||||||
|
skip_schema_check: false
|
||||||
disabled_field_types: { }
|
disabled_field_types: { }
|
||||||
disabled_caches: { }
|
disabled_caches: { }
|
||||||
disabled_request_handlers:
|
disabled_request_handlers:
|
||||||
|
@ -60,10 +61,10 @@ backend_config:
|
||||||
rows: 10
|
rows: 10
|
||||||
retrieve_data: true
|
retrieve_data: true
|
||||||
highlight_data: false
|
highlight_data: false
|
||||||
skip_schema_check: false
|
|
||||||
server_prefix: ''
|
server_prefix: ''
|
||||||
domain: generic
|
domain: generic
|
||||||
environment: default
|
environment: default
|
||||||
optimize: false
|
optimize: false
|
||||||
site_hash: true
|
site_hash: true
|
||||||
index_single_documents_fallback_count: 10
|
index_single_documents_fallback_count: 10
|
||||||
|
fallback_multiple: true
|
||||||
|
|
|
@ -49,6 +49,7 @@ backend_config:
|
||||||
http_method: AUTO
|
http_method: AUTO
|
||||||
jmx: false
|
jmx: false
|
||||||
solr_install_dir: ../../..
|
solr_install_dir: ../../..
|
||||||
|
skip_schema_check: false
|
||||||
disabled_field_types: { }
|
disabled_field_types: { }
|
||||||
disabled_caches: { }
|
disabled_caches: { }
|
||||||
disabled_request_handlers:
|
disabled_request_handlers:
|
||||||
|
@ -60,10 +61,10 @@ backend_config:
|
||||||
rows: 10
|
rows: 10
|
||||||
retrieve_data: true
|
retrieve_data: true
|
||||||
highlight_data: false
|
highlight_data: false
|
||||||
skip_schema_check: false
|
|
||||||
server_prefix: ''
|
server_prefix: ''
|
||||||
domain: generic
|
domain: generic
|
||||||
environment: default
|
environment: default
|
||||||
optimize: false
|
optimize: false
|
||||||
site_hash: true
|
site_hash: true
|
||||||
index_single_documents_fallback_count: 10
|
index_single_documents_fallback_count: 10
|
||||||
|
fallback_multiple: true
|
||||||
|
|
|
@ -15,15 +15,15 @@ use \Drupal\Core\Link;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function materio_user_form_user_login_form_alter(&$form, FormStateInterface $form_state, $form_id) {
|
function materio_user_form_user_login_form_alter(&$form, FormStateInterface $form_state, $form_id) {
|
||||||
// Drupal::logger('materio_user')->notice(print_r($form, true));
|
|
||||||
$form['name']['#attributes'] += array(
|
$form['name']['#attributes'] += array(
|
||||||
"v-model" => "mail",
|
"v-model" => "mail",
|
||||||
"@keyup.enter" => "login"
|
// "@keyup.enter" => "login"
|
||||||
);
|
);
|
||||||
|
|
||||||
$form['pass']['#attributes'] = array(
|
$form['pass']['#attributes'] = array(
|
||||||
"v-model" => "password",
|
"v-model" => "password",
|
||||||
"@keyup.enter" => "login"
|
// "@keyup.enter" => "login"
|
||||||
);
|
);
|
||||||
|
|
||||||
$url = Url::fromRoute('user.pass');
|
$url = Url::fromRoute('user.pass');
|
||||||
|
@ -34,6 +34,14 @@ function materio_user_form_user_login_form_alter(&$form, FormStateInterface $for
|
||||||
"@click.prevent" => "login"
|
"@click.prevent" => "login"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$form['message'] = array(
|
||||||
|
'#markup' => '
|
||||||
|
<span class="login-message" v-if="loginMessage">
|
||||||
|
{{ loginMessage }}
|
||||||
|
</span>
|
||||||
|
'
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function materio_user_form_user_modal_form_alter(&$form, FormStateInterface $form_state, $form_id) {
|
function materio_user_form_user_modal_form_alter(&$form, FormStateInterface $form_state, $form_id) {
|
||||||
|
|
|
@ -1263,7 +1263,7 @@ header[role="banner"] {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width: 11em;
|
width: 11em;
|
||||||
height: 0px;
|
max-height: 0px;
|
||||||
padding: 0.01em 1em;
|
padding: 0.01em 1em;
|
||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
transition: all 0.4s ease-in-out;
|
transition: all 0.4s ease-in-out;
|
||||||
|
@ -1271,10 +1271,11 @@ header[role="banner"] {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 1.7em;
|
top: 1.7em;
|
||||||
box-sizing: content-box; }
|
box-sizing: content-box;
|
||||||
|
z-index: 100; }
|
||||||
header[role="banner"] #block-userlogin:hover > section {
|
header[role="banner"] #block-userlogin:hover > section {
|
||||||
transition-delay: 0s;
|
transition-delay: 0s;
|
||||||
height: 12em;
|
max-height: 20em;
|
||||||
padding: 1em 1em;
|
padding: 1em 1em;
|
||||||
box-shadow: 0 0 10px #ccc; }
|
box-shadow: 0 0 10px #ccc; }
|
||||||
header[role="banner"] #block-userlogin .form-item {
|
header[role="banner"] #block-userlogin .form-item {
|
||||||
|
@ -1306,6 +1307,12 @@ header[role="banner"] {
|
||||||
margin: 0; }
|
margin: 0; }
|
||||||
header[role="banner"] #block-userlogin .item-list ul li a {
|
header[role="banner"] #block-userlogin .item-list ul li a {
|
||||||
font-size: 0.756em; }
|
font-size: 0.756em; }
|
||||||
|
header[role="banner"] #block-userlogin span.login-message {
|
||||||
|
color: red;
|
||||||
|
font-size: 0.693em;
|
||||||
|
line-height: 1.2;
|
||||||
|
display: block;
|
||||||
|
padding: 0 0 0.8em 0; }
|
||||||
header[role="banner"] #block-userblock h2 {
|
header[role="banner"] #block-userblock h2 {
|
||||||
display: none; }
|
display: none; }
|
||||||
header[role="banner"] #block-userblock a {
|
header[role="banner"] #block-userblock a {
|
||||||
|
@ -2375,6 +2382,12 @@ article.card {
|
||||||
display: block;
|
display: block;
|
||||||
max-width: 16em;
|
max-width: 16em;
|
||||||
font-size: 0.693em; }
|
font-size: 0.693em; }
|
||||||
|
#pricing-modal-login-register #login-register > section form span.login-message {
|
||||||
|
color: red;
|
||||||
|
font-size: 0.693em;
|
||||||
|
line-height: 1.2;
|
||||||
|
display: block;
|
||||||
|
padding: 0 0 0.8em 0; }
|
||||||
|
|
||||||
#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
|
@ -51,7 +51,7 @@ header[role="banner"]{
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width:11em;
|
width:11em;
|
||||||
height:0px;
|
max-height:0px;
|
||||||
padding:0.01em 1em;
|
padding:0.01em 1em;
|
||||||
// margin:0 0 0 -1em;
|
// margin:0 0 0 -1em;
|
||||||
box-sizing:content-box;
|
box-sizing:content-box;
|
||||||
|
@ -62,11 +62,12 @@ header[role="banner"]{
|
||||||
right:0;
|
right:0;
|
||||||
top:1.7em;
|
top:1.7em;
|
||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
|
z-index:100;
|
||||||
}
|
}
|
||||||
&:hover{
|
&:hover{
|
||||||
&>section{
|
&>section{
|
||||||
transition-delay: 0s;
|
transition-delay: 0s;
|
||||||
height:12em;
|
max-height:20em;
|
||||||
padding:1em 1em;
|
padding:1em 1em;
|
||||||
box-shadow: 0 0 10px #ccc;
|
box-shadow: 0 0 10px #ccc;
|
||||||
}
|
}
|
||||||
|
@ -113,6 +114,13 @@ header[role="banner"]{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
span.login-message{
|
||||||
|
color: red;
|
||||||
|
font-size: 0.693em;
|
||||||
|
line-height: 1.2;
|
||||||
|
display: block;
|
||||||
|
padding: 0 0 0.8em 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// non-vue userblock
|
// non-vue userblock
|
||||||
|
@ -1663,6 +1671,14 @@ article.card{
|
||||||
max-width: 16em;
|
max-width: 16em;
|
||||||
font-size: 0.693em;
|
font-size: 0.693em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span.login-message{
|
||||||
|
color: red;
|
||||||
|
font-size: 0.693em;
|
||||||
|
line-height: 1.2;
|
||||||
|
display: block;
|
||||||
|
padding: 0 0 0.8em 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
section.login{
|
section.login{
|
||||||
|
|
|
@ -15,9 +15,11 @@ export default {
|
||||||
password: ''
|
password: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// computed: {
|
computed: {
|
||||||
// ...mapState(['User'])
|
...mapState({
|
||||||
// },
|
loginMessage: state => state.User.loginMessage,
|
||||||
|
})
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
userLogin: 'User/userLogin'
|
userLogin: 'User/userLogin'
|
||||||
|
|
|
@ -11,6 +11,11 @@ export default {
|
||||||
mail:null,
|
mail:null,
|
||||||
password:null
|
password:null
|
||||||
}),
|
}),
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
loginMessage: state => state.User.loginMessage,
|
||||||
|
})
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
userLogin: 'User/userLogin'
|
userLogin: 'User/userLogin'
|
||||||
|
|
|
@ -18,6 +18,7 @@ export default {
|
||||||
mail: '',
|
mail: '',
|
||||||
csrf_token: null,
|
csrf_token: null,
|
||||||
logout_token: null,
|
logout_token: null,
|
||||||
|
loginMessage: '',
|
||||||
isloggedin: false,
|
isloggedin: false,
|
||||||
isAdmin: false,
|
isAdmin: false,
|
||||||
isAdherent: false,
|
isAdherent: false,
|
||||||
|
@ -38,6 +39,7 @@ export default {
|
||||||
state.csrf_token = token
|
state.csrf_token = token
|
||||||
},
|
},
|
||||||
setToken (state, data) {
|
setToken (state, data) {
|
||||||
|
console.log('setToken', data)
|
||||||
state.uid = data.current_user.uid
|
state.uid = data.current_user.uid
|
||||||
// state.username = data.username;
|
// state.username = data.username;
|
||||||
state.mail = data.current_user.mail
|
state.mail = data.current_user.mail
|
||||||
|
@ -45,6 +47,10 @@ export default {
|
||||||
state.isloggedin = true
|
state.isloggedin = true
|
||||||
state.logout_token = data.logout_token
|
state.logout_token = data.logout_token
|
||||||
},
|
},
|
||||||
|
setLoginMessage (state, message) {
|
||||||
|
console.log('setLoginMessage', message);
|
||||||
|
state.loginMessage = message
|
||||||
|
},
|
||||||
setUid (state, uid) {
|
setUid (state, uid) {
|
||||||
state.uid = uid
|
state.uid = uid
|
||||||
state.isloggedin = true
|
state.isloggedin = true
|
||||||
|
@ -98,7 +104,7 @@ export default {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// redirect to home page in every case
|
// redirect to home page in every case
|
||||||
window.location = window.location.origin
|
window.location = window.location.origin
|
||||||
},
|
},
|
||||||
setFlagColls (state, flagcolls) {
|
setFlagColls (state, flagcolls) {
|
||||||
console.log('User pre setFlagColls', state.flagcolls)
|
console.log('User pre setFlagColls', state.flagcolls)
|
||||||
|
@ -147,13 +153,21 @@ export default {
|
||||||
dispatch('getToken', credentials)
|
dispatch('getToken', credentials)
|
||||||
// TODO: catch failed login
|
// TODO: catch failed login
|
||||||
.then(() => {
|
.then(() => {
|
||||||
dispatch('getUser').then(userdata => {
|
// there no response here, check the original getToken method
|
||||||
console.log('User Loggedin')
|
// console.log('dispatch getToken response', response);
|
||||||
if (state.isAdmin) {
|
// check if getToken (login) went well
|
||||||
window.location.reload(true)
|
if(state.isloggedin){
|
||||||
}
|
dispatch('getUser').then(userdata => {
|
||||||
resolve()
|
console.log('User Loggedin')
|
||||||
})
|
if (state.isAdmin) {
|
||||||
|
window.location.reload(true)
|
||||||
|
}
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
console.log('user loggein failed')
|
||||||
|
Promise.reject('user loggein failed')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn('Issue with Dispatch getToken', error)
|
console.warn('Issue with Dispatch getToken', error)
|
||||||
|
@ -162,10 +176,22 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getToken ({ dispatch, commit, state }, credentials) {
|
getToken ({ dispatch, commit, state }, credentials) {
|
||||||
return REST.post('/user/login?_format=json', credentials)
|
return REST.post('/user/login?_format=json',
|
||||||
.then(({ data }) => {
|
credentials,
|
||||||
console.log('user REST getToken data', data)
|
{
|
||||||
commit('setToken', data)
|
validateStatus: function (status) {
|
||||||
|
return status >= 200 && status < 500;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
console.log('user REST getToken response', response)
|
||||||
|
if(response.status === 200){
|
||||||
|
commit('setToken', response.data)
|
||||||
|
}else if(response.data.message){
|
||||||
|
commit('setLoginMessage', response.data.message)
|
||||||
|
}else{
|
||||||
|
console.warn('Issue with getToken', response)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn('Issue with getToken', error)
|
console.warn('Issue with getToken', error)
|
||||||
|
|
Loading…
Reference in New Issue