Class: WithAccounts::PasswordsCreating::CheckParams
- Inherits:
-
LetsDoThis::Act
- Object
- LetsDoThis::Act
- WithAccounts::PasswordsCreating::CheckParams
show all
- Includes:
- ErrorsHelpers
- Defined in:
- app/scenarios/with_accounts/passwords_creating/check_params.rb
Constant Summary
collapse
- PASSWORD_REGEXP =
Regexp.new %r{^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d~!?@#$%^&*_\-+()\[\]{}><\/\\|"'.,:;]{8,128}$}
Instance Method Summary
collapse
#error_key, #format_errors
Instance Method Details
#instructions(stage) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/scenarios/with_accounts/passwords_creating/check_params.rb', line 9
def instructions(stage)
password = stage.params[:password]
password_confirmation = stage.params[:password_confirmation]
unless password == password_confirmation
errors.add(error_key, 'err')
return NOTHING_NEW
end
unless password.to_s.match?(PASSWORD_REGEXP)
errors.add(error_key, 'err')
return NOTHING_NEW
end
{ password: password }
end
|