Skip to content

Commit 1fb0829

Browse files
committed
fix: copy of login screen with password and setting screen
1 parent 3788f5a commit 1fb0829

File tree

9 files changed

+67
-80
lines changed

9 files changed

+67
-80
lines changed

_locales/en/messages.json

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
"clear": "Clear",
115115
"clearAllData": "Clear All Data",
116116
"deleteAccountWarning": "This will permanently delete your messages and contacts.",
117+
"deleteAccountFromLogin": "Are you sure you want to clear your device?",
117118
"deleteContactConfirmation": "Are you sure you want to delete this conversation?",
118119
"quoteThumbnailAlt": "Thumbnail of image from quoted message",
119120
"imageAttachmentAlt": "Image attached to message",
@@ -266,16 +267,16 @@
266267
"updateGroupDialogTitle": "Updating $name$...",
267268
"showRecoveryPhrase": "Recovery Phrase",
268269
"yourSessionID": "Your Session ID",
269-
"setAccountPasswordTitle": "Set Account Password",
270+
"setAccountPasswordTitle": "Password",
270271
"setAccountPasswordDescription": "Require password to unlock Session.",
271-
"changeAccountPasswordTitle": "Change Account Password",
272+
"changeAccountPasswordTitle": "Change Password",
272273
"changeAccountPasswordDescription": "Change the password required to unlock Session.",
273-
"removeAccountPasswordTitle": "Remove Account Password",
274+
"removeAccountPasswordTitle": "Remove Password",
274275
"removeAccountPasswordDescription": "Remove the password required to unlock Session.",
275276
"enterPassword": "Please enter your password",
276277
"confirmPassword": "Confirm password",
277278
"enterNewPassword": "Please enter your new password",
278-
"confirmNewPassword": "Confirm new password",
279+
"confirmNewPassword": "Confirm password",
279280
"showRecoveryPhrasePasswordRequest": "Please enter your password",
280281
"recoveryPhraseSavePromptMain": "Your recovery phrase is the master key to your Session ID — you can use it to restore your Session ID if you lose access to your device. Store your recovery phrase in a safe place, and don't give it to anyone.",
281282
"invalidOpenGroupUrl": "Invalid URL",
@@ -295,12 +296,12 @@
295296
"setPasswordInvalid": "Passwords do not match",
296297
"changePasswordInvalid": "The old password you entered is incorrect",
297298
"removePasswordInvalid": "Incorrect password",
298-
"setPasswordTitle": "Set Password",
299-
"changePasswordTitle": "Changed Password",
300-
"removePasswordTitle": "Removed Password",
299+
"setPasswordTitle": "Password Set",
300+
"changePasswordTitle": "Password Changed",
301+
"removePasswordTitle": "Password Removed",
301302
"setPasswordToastDescription": "Your password has been set. Please keep it safe.",
302303
"changePasswordToastDescription": "Your password has been changed. Please keep it safe.",
303-
"removePasswordToastDescription": "You have removed your password.",
304+
"removePasswordToastDescription": "Your password has been removed.",
304305
"publicChatExists": "You are already connected to this community",
305306
"connectToServerFail": "Couldn't join community",
306307
"connectingToServer": "Connecting...",
@@ -414,6 +415,9 @@
414415
"dialogClearAllDataDeletionFailedTitleQuestion": "Do you want to delete data from just this device?",
415416
"dialogClearAllDataDeletionFailedMultiple": "Data not deleted by those Service Nodes: $snodes$",
416417
"dialogClearAllDataDeletionQuestion": "Would you like to clear this device only, or delete your data from the network as well?",
418+
"clearDevice": "Clear Device",
419+
"tryAgain": "Try Again",
420+
"areYouSureClearDevice": "Are you sure you want to clear your device?",
417421
"deviceOnly": "Clear Device Only",
418422
"entireAccount": "Clear Device and Network",
419423
"areYouSureDeleteDeviceOnly": "Are you sure you want to delete your device data only?",

stylesheets/_session_password.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
.password {
22
height: 100vh;
3+
color: white; //TODO theming update
34

45
.clear-data-wrapper {
5-
margin: auto;
6+
display: flex;
7+
height: 100%;
8+
width: 100%;
9+
background-color: $session-color-black;
10+
11+
.clear-data-container {
12+
margin: auto;
13+
}
614

715
.warning-info-area {
816
display: flex;

ts/components/SessionPasswordPrompt.tsx

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ import autoBind from 'auto-bind';
77
import { SessionButton, SessionButtonColor, SessionButtonType } from './basic/SessionButton';
88
import { SessionSpinner } from './basic/SessionSpinner';
99
import { switchHtmlToDarkTheme } from '../state/ducks/SessionTheme';
10+
import { ToastUtils } from '../session/utils';
11+
import { isString } from 'lodash';
1012

1113
interface State {
12-
error: string;
1314
errorCount: number;
1415
clearDataView: boolean;
1516
loading: boolean;
1617
}
1718

1819
export const MAX_LOGIN_TRIES = 3;
20+
// tslint:disable: use-simple-attributes
1921

2022
const TextPleaseWait = (props: { isLoading: boolean }) => {
2123
if (!props.isLoading) {
@@ -31,7 +33,6 @@ class SessionPasswordPromptInner extends React.PureComponent<{}, State> {
3133
super(props);
3234

3335
this.state = {
34-
error: '',
3536
errorCount: 0,
3637
clearDataView: false,
3738
loading: false,
@@ -48,7 +49,6 @@ class SessionPasswordPromptInner extends React.PureComponent<{}, State> {
4849
}
4950

5051
public render() {
51-
const showResetElements = this.state.errorCount >= MAX_LOGIN_TRIES;
5252
const isLoading = this.state.loading;
5353

5454
const wrapperClass = this.state.clearDataView
@@ -59,13 +59,13 @@ class SessionPasswordPromptInner extends React.PureComponent<{}, State> {
5959
: 'password-prompt-container';
6060
const infoAreaClass = this.state.clearDataView ? 'warning-info-area' : 'password-info-area';
6161
const infoTitle = this.state.clearDataView
62-
? window.i18n('clearAllData')
62+
? window.i18n('clearDevice')
6363
: window.i18n('passwordViewTitle');
6464
const buttonGroup = this.state.clearDataView
6565
? this.renderClearDataViewButtons()
6666
: this.renderPasswordViewButtons();
6767
const featureElement = this.state.clearDataView ? (
68-
<p className="text-center">{window.i18n('deleteAccountWarning')}</p>
68+
<p className="text-center">{window.i18n('deleteAccountFromLogin')}</p>
6969
) : (
7070
<input
7171
id="password-prompt-input"
@@ -81,19 +81,7 @@ class SessionPasswordPromptInner extends React.PureComponent<{}, State> {
8181
const infoIcon = this.state.clearDataView ?? (
8282
<SessionIcon iconType="warning" iconSize={35} iconColor="#ce0000" />
8383
);
84-
const errorSection = !this.state.clearDataView && (
85-
<div className="password-prompt-error-section">
86-
{this.state.error && (
87-
<>
88-
{showResetElements ? (
89-
<div className="session-label warning">{window.i18n('maxPasswordAttempts')}</div>
90-
) : (
91-
<div className="session-label primary">{this.state.error}</div>
92-
)}
93-
</>
94-
)}
95-
</div>
96-
);
84+
9785
const spinner = isLoading ? <SessionSpinner loading={true} /> : null;
9886

9987
return (
@@ -108,7 +96,6 @@ class SessionPasswordPromptInner extends React.PureComponent<{}, State> {
10896
{spinner || featureElement}
10997
<TextPleaseWait isLoading={isLoading} />
11098

111-
{errorSection}
11299
{buttonGroup}
113100
</div>
114101
</div>
@@ -137,7 +124,12 @@ class SessionPasswordPromptInner extends React.PureComponent<{}, State> {
137124
errorCount: this.state.errorCount + 1,
138125
});
139126

140-
this.setState({ error });
127+
if (error && isString(error)) {
128+
ToastUtils.pushToastError('onLogin', error);
129+
} else if (error?.message && isString(error.message)) {
130+
ToastUtils.pushToastError('onLogin', error.message);
131+
}
132+
141133
global.setTimeout(() => {
142134
document.getElementById('password-prompt-input')?.focus();
143135
}, 50);
@@ -160,7 +152,6 @@ class SessionPasswordPromptInner extends React.PureComponent<{}, State> {
160152

161153
private initClearDataView() {
162154
this.setState({
163-
error: '',
164155
errorCount: 0,
165156
clearDataView: true,
166157
});
@@ -174,17 +165,17 @@ class SessionPasswordPromptInner extends React.PureComponent<{}, State> {
174165
{showResetElements && (
175166
<>
176167
<SessionButton
177-
text="Reset Database"
178-
buttonType={SessionButtonType.BrandOutline}
168+
text={window.i18n('clearDevice')}
169+
buttonType={SessionButtonType.BrandOutline} // TODO: theming update
179170
buttonColor={SessionButtonColor.Danger}
180171
onClick={this.initClearDataView}
181172
/>
182173
</>
183174
)}
184175
<SessionButton
185-
text={window.i18n('done')}
186-
buttonType={SessionButtonType.BrandOutline}
187-
buttonColor={SessionButtonColor.Green}
176+
text={showResetElements ? window.i18n('tryAgain') : window.i18n('done')}
177+
buttonType={SessionButtonType.BrandOutline} // TODO: theming update
178+
buttonColor={SessionButtonColor.White}
188179
onClick={this.initLogin}
189180
/>
190181
</div>
@@ -194,21 +185,20 @@ class SessionPasswordPromptInner extends React.PureComponent<{}, State> {
194185
private renderClearDataViewButtons(): JSX.Element {
195186
return (
196187
<div className="button-group">
188+
<SessionButton
189+
text={window.i18n('clearDevice')}
190+
buttonType={SessionButtonType.BrandOutline}
191+
buttonColor={SessionButtonColor.Danger}
192+
onClick={window.clearLocalData}
193+
/>
197194
<SessionButton
198195
text={window.i18n('cancel')}
199-
buttonType={SessionButtonType.Default}
200-
buttonColor={SessionButtonColor.Primary}
196+
buttonType={SessionButtonType.BrandOutline}
197+
buttonColor={SessionButtonColor.White} // TODO: theming update
201198
onClick={() => {
202199
this.setState({ clearDataView: false });
203200
}}
204201
/>
205-
206-
<SessionButton
207-
text={window.i18n('clearAllData')}
208-
buttonType={SessionButtonType.Default}
209-
buttonColor={SessionButtonColor.Danger}
210-
onClick={window.clearLocalData}
211-
/>
212202
</div>
213203
);
214204
}

ts/components/conversation/message/message-content/MessageAuthorText.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ type Props = {
2020
messageId: string;
2121
};
2222

23-
const StyledAuthorContainer = styled(Flex)`color: var(--color-text)`;
23+
const StyledAuthorContainer = styled(Flex)`
24+
color: var(--color-text);
25+
`;
2426

2527
export const MessageAuthorText = (props: Props) => {
2628
const selected = useSelector(state => getMessageAuthorProps(state as any, props.messageId));

ts/components/dialog/SessionPasswordDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export class SessionPasswordDialog extends React.Component<Props, State> {
117117
<div className="session-modal__button-group">
118118
<SessionButton text={window.i18n('cancel')} onClick={this.closeDialog} />
119119
<SessionButton
120-
text={window.i18n('ok')}
120+
text={window.i18n('done')}
121121
buttonColor={confirmButtonColor}
122122
onClick={this.setPassword}
123123
/>

ts/components/settings/BlockedList.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ const BlockedEntriesContainer = styled.div`
1818
overflow: auto;
1919
min-height: 40px;
2020
max-height: 100%;
21-
background: var(--color-input-background); // TODO theming update
21+
background: inherit; // TODO theming update
2222
`;
2323

2424
const BlockedEntriesRoundedContainer = styled.div`
2525
overflow: hidden;
2626
border-radius: 16px;
2727
padding: var(--margins-lg);
28-
background: var(--color-input-background); // TODO theming update
28+
background: none; // TODO theming update
29+
border: 1px solid #e5e5ea; // TODO Theming update
2930
`;
3031

3132
const BlockedContactsSection = styled.div`

0 commit comments

Comments
 (0)