Merge pull request #11125 from demarches-simplifiees/post_password_in_complexity_test
Tech: vérifie la complexité avec un post
This commit is contained in:
commit
438bf21d18
9 changed files with 45 additions and 9 deletions
|
@ -16,7 +16,12 @@
|
||||||
|
|
||||||
.fr-fieldset__element
|
.fr-fieldset__element
|
||||||
= render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field,
|
= render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field,
|
||||||
opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }, aria: {describedby: 'password_hint'}})
|
opts: { autofocus: 'true',
|
||||||
|
autocomplete: 'new-password',
|
||||||
|
data: { controller: 'turbo-input',
|
||||||
|
turbo_input_url_value: show_password_complexity_path,
|
||||||
|
turbo_input_method_value: 'post' },
|
||||||
|
aria: {describedby: 'password_hint'}})
|
||||||
|
|
||||||
#password_complexity
|
#password_complexity
|
||||||
= render PasswordComplexityComponent.new
|
= render PasswordComplexityComponent.new
|
||||||
|
|
|
@ -5,10 +5,12 @@ import { ApplicationController } from './application_controller';
|
||||||
export class TurboInputController extends ApplicationController {
|
export class TurboInputController extends ApplicationController {
|
||||||
static values = {
|
static values = {
|
||||||
url: String,
|
url: String,
|
||||||
|
method: { type: String, default: 'get' },
|
||||||
loadOnConnect: { type: Boolean, default: false }
|
loadOnConnect: { type: Boolean, default: false }
|
||||||
};
|
};
|
||||||
|
|
||||||
declare readonly urlValue: string;
|
declare readonly urlValue: string;
|
||||||
|
declare readonly methodValue: string;
|
||||||
declare readonly loadOnConnectValue: boolean;
|
declare readonly loadOnConnectValue: boolean;
|
||||||
|
|
||||||
connect(): void {
|
connect(): void {
|
||||||
|
@ -22,6 +24,8 @@ export class TurboInputController extends ApplicationController {
|
||||||
const target = this.element as HTMLInputElement;
|
const target = this.element as HTMLInputElement;
|
||||||
const url = new URL(this.urlValue, document.baseURI);
|
const url = new URL(this.urlValue, document.baseURI);
|
||||||
url.searchParams.append(target.name, target.value);
|
url.searchParams.append(target.name, target.value);
|
||||||
httpRequest(url.toString()).turbo();
|
httpRequest(url.toString(), {
|
||||||
|
method: this.methodValue
|
||||||
|
}).turbo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,12 @@
|
||||||
|
|
||||||
.fr-fieldset__element
|
.fr-fieldset__element
|
||||||
= render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field,
|
= render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field,
|
||||||
opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }, aria: {describedby: 'password_hint'}})
|
opts: { autofocus: 'true',
|
||||||
|
autocomplete: 'new-password',
|
||||||
|
data: { controller: 'turbo-input',
|
||||||
|
turbo_input_url_value: show_password_complexity_path,
|
||||||
|
turbo_input_method_value: 'post' },
|
||||||
|
aria: {describedby: 'password_hint'}})
|
||||||
|
|
||||||
#password_complexity
|
#password_complexity
|
||||||
= render PasswordComplexityComponent.new
|
= render PasswordComplexityComponent.new
|
||||||
|
|
|
@ -21,7 +21,12 @@
|
||||||
|
|
||||||
.fr-fieldset__element
|
.fr-fieldset__element
|
||||||
= render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field,
|
= render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field,
|
||||||
opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }, aria: {describedby: 'password_hint'}})
|
opts: { autofocus: 'true',
|
||||||
|
autocomplete: 'new-password',
|
||||||
|
data: { controller: 'turbo-input',
|
||||||
|
turbo_input_url_value: show_password_complexity_path,
|
||||||
|
turbo_input_method_value: 'post' },
|
||||||
|
aria: {describedby: 'password_hint'}})
|
||||||
|
|
||||||
#password_complexity
|
#password_complexity
|
||||||
= render PasswordComplexityComponent.new
|
= render PasswordComplexityComponent.new
|
||||||
|
|
|
@ -14,7 +14,13 @@
|
||||||
|
|
||||||
.fr-fieldset__element
|
.fr-fieldset__element
|
||||||
= render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field,
|
= render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field,
|
||||||
opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }, aria: {describedby: 'password_hint'}})
|
opts: { autofocus: 'true',
|
||||||
|
autocomplete: 'new-password',
|
||||||
|
data: { controller: 'turbo-input',
|
||||||
|
turbo_input_url_value: show_password_complexity_path,
|
||||||
|
turbo_input_method_value: 'post',
|
||||||
|
},
|
||||||
|
aria: {describedby: 'password_hint'}})
|
||||||
|
|
||||||
#password_complexity
|
#password_complexity
|
||||||
= render PasswordComplexityComponent.new
|
= render PasswordComplexityComponent.new
|
||||||
|
|
|
@ -18,7 +18,12 @@
|
||||||
|
|
||||||
.fr-fieldset__element
|
.fr-fieldset__element
|
||||||
= render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field,
|
= render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field,
|
||||||
opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }, aria: {describedby: 'password_hint'}})
|
opts: { autofocus: 'true',
|
||||||
|
autocomplete: 'new-password',
|
||||||
|
data: { controller: 'turbo-input',
|
||||||
|
turbo_input_url_value: show_password_complexity_path,
|
||||||
|
turbo_input_method_value: 'post' },
|
||||||
|
aria: {describedby: 'password_hint'}})
|
||||||
|
|
||||||
#password_complexity
|
#password_complexity
|
||||||
= render PasswordComplexityComponent.new
|
= render PasswordComplexityComponent.new
|
||||||
|
|
|
@ -20,7 +20,13 @@
|
||||||
|
|
||||||
.fr-fieldset__element
|
.fr-fieldset__element
|
||||||
= render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field,
|
= render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field,
|
||||||
opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path, email_input_target: 'next'}, aria: {describedby: 'password_hint'}})
|
opts: { autofocus: 'true',
|
||||||
|
autocomplete: 'new-password',
|
||||||
|
data: { controller: 'turbo-input',
|
||||||
|
turbo_input_url_value: show_password_complexity_path,
|
||||||
|
turbo_input_method_value: 'post',
|
||||||
|
email_input_target: 'next' },
|
||||||
|
aria: {describedby: 'password_hint'}})
|
||||||
|
|
||||||
#password_complexity
|
#password_complexity
|
||||||
= render PasswordComplexityComponent.new
|
= render PasswordComplexityComponent.new
|
||||||
|
|
|
@ -171,7 +171,7 @@ Rails.application.routes.draw do
|
||||||
get 'logout' => 'users/sessions#logout'
|
get 'logout' => 'users/sessions#logout'
|
||||||
end
|
end
|
||||||
|
|
||||||
get 'password_complexity' => 'password_complexity#show', as: 'show_password_complexity'
|
post 'password_complexity' => 'password_complexity#show', as: 'show_password_complexity'
|
||||||
get 'check_email' => 'email_checker#show', as: 'show_email_suggestions'
|
get 'check_email' => 'email_checker#show', as: 'show_email_suggestions'
|
||||||
|
|
||||||
resources :targeted_user_links, only: [:show]
|
resources :targeted_user_links, only: [:show]
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe PasswordComplexityController, type: :controller do
|
||||||
{ user: { password: 'motDePasseTropFacile' } }
|
{ user: { password: 'motDePasseTropFacile' } }
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { get :show, format: :turbo_stream, params: params }
|
subject { post :show, format: :turbo_stream, params: params }
|
||||||
|
|
||||||
it 'computes a password score' do
|
it 'computes a password score' do
|
||||||
subject
|
subject
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue