Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show error about wrong time on sync init #2076

Merged
merged 2 commits into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ deps = {
"vendor/bip39wally-core-native": "https://github.com/brave-intl/bip39wally-core-native.git@9b119931c702d55be994117eb505d56310720b1d",
"vendor/bat-native-anonize": "https://github.com/brave-intl/bat-native-anonize.git@b8ef1a3f85aec0a0522a9230d59b3958a2150fab",
"vendor/bat-native-tweetnacl": "https://github.com/brave-intl/bat-native-tweetnacl.git@1b4362968c8f22720bfb75af6f506d4ecc0f3116",
"components/brave_sync/extension/brave-sync": "https://github.com/brave/sync.git@42a3630239648383968db17732480f817039e6c1",
"components/brave_sync/extension/brave-sync": "https://github.com/brave/sync.git@36470f7b7c19ac0e072f772535065e16c8741b12",
"components/brave_sync/extension/brave-crypto": "https://github.com/brave/crypto@0cd5dda4fd7c948d6c13107cb4f9b7d293ffc7e3",
"vendor/bat-native-usermodel": "https://github.com/brave-intl/bat-native-usermodel.git@c3b6111aa862c5c452c84be8a225d5f1df32b284",
"vendor/challenge_bypass_ristretto_ffi": "https://github.com/brave-intl/challenge-bypass-ristretto-ffi.git@2c0e28f76e4b6f53947bf4faa5afd93614f96aca",
Expand Down
2 changes: 2 additions & 0 deletions browser/ui/webui/brave_webui_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,8 @@ void CustomizeWebUIHTMLSource(const std::string &name,
{ "errorMissingCodeTitle", IDS_BRAVE_SYNC_ERROR_MISSING_SYNC_CODE_TITLE }, // NOLINT
{ "errorSyncInitFailedTitle", IDS_BRAVE_SYNC_ERROR_INIT_FAILED_TITLE },
{ "errorSyncInitFailedDescription", IDS_BRAVE_SYNC_ERROR_INIT_FAILED_DESCRIPTION }, // NOLINT
{ "errorSyncRequiresCorrectTimeTitle", IDS_BRAVE_SYNC_REQUIRES_CORRECT_TIME_TITLE }, // NOLINT
{ "errorSyncRequiresCorrectTimeDescription", IDS_BRAVE_SYNC_REQUIRES_CORRECT_TIME_DESCRIPTION }, // NOLINT
}
}, {
std::string("adblock"), {
Expand Down
6 changes: 4 additions & 2 deletions components/brave_sync/extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,10 @@ class InjectedObject {
chrome.braveSync.getInitData(arg1/*syncVersion*/);
break;
case "sync-setup-error":
console.log(`"sync-setup-error" error=${JSON.stringify(arg1)}`);
chrome.braveSync.syncSetupError('ERR_SYNC_INIT_FAILED');
console.log(`"sync-setup-error" error=${arg1}`);
var errorToPass = (arg1 === 'Credential server response 400. Signed request body of the client timestamp is required.') ?
'ERR_SYNC_REQUIRES_CORRECT_TIME' : 'ERR_SYNC_INIT_FAILED'
chrome.braveSync.syncSetupError(errorToPass);
break;
case "sync-debug":
console.log(`"sync-debug" message=${JSON.stringify(arg1)}`);
Expand Down
8 changes: 8 additions & 0 deletions components/brave_sync/ui/components/enabledContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ export default class SyncEnabledContent extends React.PureComponent<Props, State
</AlertBox>
: null
}
{
syncData.error === 'ERR_SYNC_REQUIRES_CORRECT_TIME'
? <AlertBox okString={getLocale('ok')} onClickOk={this.onUserNoticedError}>
<Title>{getLocale('errorSyncRequiresCorrectTimeTitle')}</Title>
<SubTitle>{getLocale('errorSyncRequiresCorrectTimeDescription')}</SubTitle>
</AlertBox>
: null
}
{
removeDevice
? (
Expand Down
8 changes: 8 additions & 0 deletions components/brave_sync/ui/components/modals/deviceType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ export default class DeviceTypeModal extends React.PureComponent<Props, State> {
</AlertBox>
: null
}
{
syncData.error === 'ERR_SYNC_REQUIRES_CORRECT_TIME'
? <AlertBox okString={getLocale('ok')} onClickOk={this.onUserNoticedError}>
<Title>{getLocale('errorSyncRequiresCorrectTimeTitle')}</Title>
<SubTitle>{getLocale('errorSyncRequiresCorrectTimeDescription')}</SubTitle>
</AlertBox>
: null
}
{
scanCode
? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ export default class EnterSyncCodeModal extends React.PureComponent<Props, State
</AlertBox>
: null
}
{
syncData.error === 'ERR_SYNC_REQUIRES_CORRECT_TIME'
? <AlertBox okString={getLocale('ok')} onClickOk={this.onUserNoticedError}>
<Title>{getLocale('errorSyncRequiresCorrectTimeTitle')}</Title>
<SubTitle>{getLocale('errorSyncRequiresCorrectTimeDescription')}</SubTitle>
</AlertBox>
: null
}
<ModalHeader>
<div>
<ModalTitle level={1}>{getLocale('enterSyncCode')}</ModalTitle>
Expand Down
1 change: 1 addition & 0 deletions components/definitions/sync.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export type SetupErrorType =
'ERR_SYNC_MISSING_WORDS' |
'ERR_SYNC_WRONG_WORDS' |
'ERR_SYNC_INIT_FAILED' |
'ERR_SYNC_REQUIRES_CORRECT_TIME' |
undefined

export interface State {
Expand Down
2 changes: 2 additions & 0 deletions components/resources/brave_components_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,8 @@
<message name="IDS_BRAVE_SYNC_ERROR_MISSING_SYNC_CODE_TITLE" desc="Error message in dialog for when device name is missing (description)">Please add a sync code.</message>
<message name="IDS_BRAVE_SYNC_ERROR_INIT_FAILED_TITLE" desc="Error message in dialog for when a Sync error happens in the back-end">Couldn't contact Sync servers</message>
<message name="IDS_BRAVE_SYNC_ERROR_INIT_FAILED_DESCRIPTION" desc="Error message in dialog for when a Sync error happens in the back-end">You might be having network trouble, or there could be a problem with the Sync servers.</message>
<message name="IDS_BRAVE_SYNC_REQUIRES_CORRECT_TIME_TITLE" desc="Error message in dialog for when a Sync could not couldn't connect to Sync servers, because of wrong system time (title)">Couldn't connect to Sync servers</message>
<message name="IDS_BRAVE_SYNC_REQUIRES_CORRECT_TIME_DESCRIPTION" desc="Error message in dialog for when a Sync could not couldn't connect to Sync servers, because of wrong system time (description)">You might be having wrong system time or timezone setup on your device. Please setup the correct time and timezone</message>
</messages>
</release>
</grit>