Skip to content

Commit

Permalink
Merge pull request #1457 from Bilb/fix-password-length
Browse files Browse the repository at this point in the history
Fix the password length limit when not setting a new password
  • Loading branch information
Bilb authored Jan 27, 2021
2 parents ec46a4d + 43ec14e commit 0a533d4
Show file tree
Hide file tree
Showing 14 changed files with 147 additions and 176 deletions.
2 changes: 1 addition & 1 deletion _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,7 @@
"message": "Failed to set password"
},
"passwordLengthError": {
"message": "Password must be between 6 and 50 characters long",
"message": "Password must be between 6 and 64 characters long",
"description": "Error string shown to the user when password doesn't meet length criteria"
},
"passwordTypeError": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/fr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1698,7 +1698,7 @@
"message": "Échec de la définition du mot de passe"
},
"passwordLengthError": {
"message": "Le mot de passe doit avoir une longueur comprise entre 6 et 50 caractères",
"message": "Le mot de passe doit avoir une longueur comprise entre 6 et 64 caractères",
"description": "Error string shown to the user when password doesn't meet length criteria"
},
"passwordTypeError": {
Expand Down
2 changes: 1 addition & 1 deletion _locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1698,7 +1698,7 @@
"message": "Failed to set password"
},
"passwordLengthError": {
"message": "Password must be between 6 and 50 characters long",
"message": "Password must be between 6 and 64 characters long",
"description": "Error string shown to the user when password doesn't meet length criteria"
},
"passwordTypeError": {
Expand Down
1 change: 0 additions & 1 deletion password_preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ window.CONSTANTS = {
MAX_USERNAME_LENGTH: 20,
};

window.passwordUtil = require('./ts/util/passwordUtils');
window.Signal.Logs = require('./js/modules/logs');

window.resetDatabase = () => {
Expand Down
1 change: 0 additions & 1 deletion preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ window.setPassword = (passPhrase, oldPhrase) =>
ipc.send('set-password', passPhrase, oldPhrase);
});

window.passwordUtil = require('./ts/util/passwordUtils');
window.libsession = require('./ts/session');

window.getMessageController =
Expand Down
5 changes: 2 additions & 3 deletions ts/components/Lightbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ export class Lightbox extends React.Component<Props> {
}

if (current.paused) {
// tslint:disable-next-line no-floating-promises
current.play();
void current.play();
} else {
current.pause();
}
Expand Down Expand Up @@ -272,7 +271,7 @@ export class Lightbox extends React.Component<Props> {
</div>
</div>
<div style={styles.controls}>
<Flex flexGrow={1}>
<Flex flex="1 1 auto">
<IconButton
type="close"
onClick={this.onClose}
Expand Down
5 changes: 2 additions & 3 deletions ts/components/session/RegistrationTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { SessionSpinner } from './SessionSpinner';
import { StringUtils, ToastUtils } from '../../session/utils';
import { lightTheme } from '../../state/ducks/SessionTheme';
import { ConversationController } from '../../session/conversations';
import { PasswordUtil } from '../../util';

enum SignInMode {
Default,
Expand Down Expand Up @@ -454,7 +455,6 @@ export class RegistrationTabs extends React.Component<any, State> {
error={this.state.passwordErrorString}
type="password"
placeholder={window.i18n('enterOptionalPassword')}
maxLength={window.CONSTANTS.MAX_PASSWORD_LENGTH}
onValueChanged={(val: string) => {
this.onPasswordChanged(val);
}}
Expand All @@ -470,7 +470,6 @@ export class RegistrationTabs extends React.Component<any, State> {
error={passwordsDoNotMatch}
type="password"
placeholder={window.i18n('confirmPassword')}
maxLength={window.CONSTANTS.MAX_PASSWORD_LENGTH}
onValueChanged={(val: string) => {
this.onPasswordVerifyChanged(val);
}}
Expand Down Expand Up @@ -592,7 +591,7 @@ export class RegistrationTabs extends React.Component<any, State> {
return;
}

const error = window.passwordUtil.validatePassword(input, window.i18n);
const error = PasswordUtil.validatePassword(input, window.i18n);
if (error) {
this.setState({
passwordErrorString: error,
Expand Down
Loading

0 comments on commit 0a533d4

Please sign in to comment.