-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #21170 - move password_strength.js to wepback
- Loading branch information
Showing
12 changed files
with
152 additions
and
99 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
<%= javascript 'password_strength' %> | ||
<% title _("Users") %> | ||
<% title_actions new_link(_("Create User")) %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,6 @@ | |
auth_source_ldap | ||
subnets | ||
hidden_values | ||
password_strength | ||
proxy_status | ||
about | ||
parameter_override) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,3 +47,4 @@ export function testMail(item, url, param = {}) { | |
} | ||
}); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
webpack/assets/javascripts/react_app/components/passwordStrength/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from 'react'; | ||
import CommonForm from '../common/forms/CommonForm'; | ||
import ReactPasswordStrength from 'react-password-strength'; | ||
import './password_strength.scss'; | ||
|
||
class PasswordStrength extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.checkRetype = this.checkRetype.bind(this); | ||
this.state = { | ||
password: '', | ||
error: props.data.verify.error | ||
}; | ||
} | ||
checkRetype(event) { | ||
if (event.target.value !== this.state.password) { | ||
this.setState({error: __('Passwords do not match')}); | ||
} else { | ||
this.setState({error: undefined}); | ||
} | ||
} | ||
|
||
render() { | ||
const {className, id, name, verify, error} = this.props.data; | ||
const username = document.getElementById('user_login').value; | ||
|
||
return ( | ||
<div> | ||
<CommonForm label={__('Password')} touched={true} error={error}> | ||
<ReactPasswordStrength | ||
changeCallback={(data) => {this.setState({password: data.password});}} | ||
minLength={6} | ||
minScore={2} | ||
userInputs={[username]} | ||
tooShortWord={__('Too short')} | ||
scoreWords={[__('Weak'), __('Medium'), __('Normal'), __('Strong'), __('Very strong')]} | ||
inputProps={{autoComplete: 'new-password', name: name, | ||
id: id, className: `${className}`}} | ||
/> | ||
</CommonForm> | ||
{ verify && | ||
<CommonForm label={__('Verify')} touched={true} error={this.state.error} > | ||
<input name={verify.name} type="password" | ||
onChange={this.checkRetype} className="form-control" /> | ||
</CommonForm>} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default PasswordStrength; |
76 changes: 76 additions & 0 deletions
76
webpack/assets/javascripts/react_app/components/passwordStrength/password_strength.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
.ReactPasswordStrength { | ||
.ReactPasswordStrength-input { | ||
width: 100%; | ||
font-size: 12px; | ||
font-family: 'Open Sans', Helvetica, Arial, sans-serif; | ||
padding: 2px 30px 2px 6px; | ||
font-style: normal; | ||
} | ||
|
||
.ReactPasswordStrength-strength-desc { | ||
padding: 6px 10px; | ||
right: -140px; | ||
font-size: 12px; | ||
width: 60%; | ||
text-align: left; | ||
font-style: normal; | ||
font-family: 'Open Sans', Helvetica, Arial, sans-serif; | ||
|
||
} | ||
} | ||
|
||
#password_react { | ||
.form-group.has-error .ReactPasswordStrength-input { | ||
border: 1px solid #c00; | ||
} | ||
|
||
.is-strength-0 { | ||
.ReactPasswordStrength-strength-desc { | ||
color: #a30000; | ||
} | ||
|
||
.ReactPasswordStrength-strength-bar { | ||
background: #a30000; | ||
} | ||
} | ||
|
||
.is-strength-1 { | ||
.ReactPasswordStrength-strength-desc { | ||
color: #ec7a08; | ||
} | ||
|
||
.ReactPasswordStrength-strength-bar { | ||
background: #ec7a08; | ||
} | ||
} | ||
|
||
.is-strength-2 { | ||
.ReactPasswordStrength-strength-desc { | ||
color: #f0ab00; | ||
} | ||
|
||
.ReactPasswordStrength-strength-bar { | ||
background: #f0ab00; | ||
} | ||
} | ||
|
||
.is-strength-3 { | ||
.ReactPasswordStrength-strength-desc { | ||
color: #3f9c35; | ||
} | ||
|
||
.ReactPasswordStrength-strength-bar { | ||
background: #3f9c35; | ||
} | ||
} | ||
|
||
.is-strength-4 { | ||
.ReactPasswordStrength-strength-desc { | ||
color: #1e4f18; | ||
} | ||
|
||
.ReactPasswordStrength-strength-bar { | ||
background: #1e4f18; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters