feat: cancelable challenges
This commit is contained in:
@@ -33,9 +33,9 @@
|
|||||||
ng-disabled="ctrl.state.processing"
|
ng-disabled="ctrl.state.processing"
|
||||||
)
|
)
|
||||||
.sk-label {{ctrl.state.processing ? 'Generating Keys...' : 'Submit'}}
|
.sk-label {{ctrl.state.processing ? 'Generating Keys...' : 'Submit'}}
|
||||||
.sk-panel-row(ng-if="ctrl.cancelable")
|
.sk-panel-row(ng-if="ctrl.challenge.cancelable")
|
||||||
a.sk-panel-row.sk-a.info.centered(
|
a.sk-panel-row.sk-a.info.centered(
|
||||||
ng-if="ctrl.cancelable"
|
ng-if="ctrl.challenge.cancelable"
|
||||||
ng-click="ctrl.cancel()"
|
ng-click="ctrl.cancel()"
|
||||||
) Cancel
|
) Cancel
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ class ChallengeModalCtrl extends PureViewCtrl<{}, ChallengeModalState> {
|
|||||||
private $element: JQLite
|
private $element: JQLite
|
||||||
application!: WebApplication
|
application!: WebApplication
|
||||||
challenge!: Challenge
|
challenge!: Challenge
|
||||||
private cancelable = false
|
|
||||||
|
|
||||||
/* @ngInject */
|
/* @ngInject */
|
||||||
constructor(
|
constructor(
|
||||||
@@ -62,26 +61,10 @@ class ChallengeModalCtrl extends PureViewCtrl<{}, ChallengeModalState> {
|
|||||||
invalid: false
|
invalid: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
let showForgotPasscodeLink = false;
|
const showForgotPasscodeLink = [
|
||||||
switch (this.challenge.reason) {
|
ChallengeReason.ApplicationUnlock,
|
||||||
case ChallengeReason.ApplicationUnlock:
|
ChallengeReason.Migration
|
||||||
showForgotPasscodeLink = true;
|
].includes(this.challenge.reason);
|
||||||
this.cancelable = false;
|
|
||||||
break;
|
|
||||||
case ChallengeReason.Migration:
|
|
||||||
showForgotPasscodeLink = true;
|
|
||||||
this.cancelable = false;
|
|
||||||
break;
|
|
||||||
case ChallengeReason.ProtocolUpgrade:
|
|
||||||
showForgotPasscodeLink = false;
|
|
||||||
this.cancelable = true;
|
|
||||||
break;
|
|
||||||
case ChallengeReason.ResaveRootKey:
|
|
||||||
showForgotPasscodeLink = false;
|
|
||||||
this.cancelable = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
this.cancelable = !showForgotPasscodeLink
|
|
||||||
this.setState({
|
this.setState({
|
||||||
prompts,
|
prompts,
|
||||||
values,
|
values,
|
||||||
@@ -143,7 +126,7 @@ class ChallengeModalCtrl extends PureViewCtrl<{}, ChallengeModalState> {
|
|||||||
|
|
||||||
/** @template */
|
/** @template */
|
||||||
cancel() {
|
cancel() {
|
||||||
if (this.cancelable) {
|
if (this.challenge.cancelable) {
|
||||||
this.application!.cancelChallenge(this.challenge);
|
this.application!.cancelChallenge(this.challenge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export declare class DesktopManager extends ApplicationService {
|
|||||||
updateObservers: {
|
updateObservers: {
|
||||||
callback: UpdateObserverCallback;
|
callback: UpdateObserverCallback;
|
||||||
}[];
|
}[];
|
||||||
isDesktop: any;
|
isDesktop: boolean;
|
||||||
dataLoaded: boolean;
|
dataLoaded: boolean;
|
||||||
lastSearchedText?: string;
|
lastSearchedText?: string;
|
||||||
private removeComponentObserver?;
|
private removeComponentObserver?;
|
||||||
@@ -45,7 +45,6 @@ export declare class DesktopManager extends ApplicationService {
|
|||||||
};
|
};
|
||||||
desktop_deregisterComponentActivationObserver(observer: ComponentActivationObserver): void;
|
desktop_deregisterComponentActivationObserver(observer: ComponentActivationObserver): void;
|
||||||
notifyComponentActivation(component: SNComponent): Promise<void>;
|
notifyComponentActivation(component: SNComponent): Promise<void>;
|
||||||
onExtensionsReady(): void;
|
|
||||||
desktop_requestBackupFile(): Promise<string | undefined>;
|
desktop_requestBackupFile(): Promise<string | undefined>;
|
||||||
desktop_didBeginBackup(): void;
|
desktop_didBeginBackup(): void;
|
||||||
desktop_didFinishBackup(success: boolean): void;
|
desktop_didFinishBackup(success: boolean): void;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ export declare enum AppStateEvent {
|
|||||||
EditorFocused = 5,
|
EditorFocused = 5,
|
||||||
BeganBackupDownload = 6,
|
BeganBackupDownload = 6,
|
||||||
EndedBackupDownload = 7,
|
EndedBackupDownload = 7,
|
||||||
DesktopExtsReady = 8,
|
|
||||||
WindowDidFocus = 9,
|
WindowDidFocus = 9,
|
||||||
WindowDidBlur = 10
|
WindowDidBlur = 10
|
||||||
}
|
}
|
||||||
@@ -64,9 +63,5 @@ export declare class AppState {
|
|||||||
editorDidFocus(eventSource: EventSource): void;
|
editorDidFocus(eventSource: EventSource): void;
|
||||||
beganBackupDownload(): void;
|
beganBackupDownload(): void;
|
||||||
endedBackupDownload(success: boolean): void;
|
endedBackupDownload(success: boolean): void;
|
||||||
/**
|
|
||||||
* When the desktop appplication extension server is ready.
|
|
||||||
*/
|
|
||||||
desktopExtensionsReady(): void;
|
|
||||||
}
|
}
|
||||||
export {};
|
export {};
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ export declare function getPlatformString(): string;
|
|||||||
export declare function dateToLocalizedString(date: Date): string;
|
export declare function dateToLocalizedString(date: Date): string;
|
||||||
/** Via https://davidwalsh.name/javascript-debounce-function */
|
/** Via https://davidwalsh.name/javascript-debounce-function */
|
||||||
export declare function debounce(this: any, func: any, wait: number, immediate?: boolean): () => void;
|
export declare function debounce(this: any, func: any, wait: number, immediate?: boolean): () => void;
|
||||||
export declare function isDesktopApplication(): any;
|
|
||||||
export declare function preventRefreshing(message: string, operation: () => Promise<void> | void): Promise<void>;
|
export declare function preventRefreshing(message: string, operation: () => Promise<void> | void): Promise<void>;
|
||||||
|
export declare function isDesktopApplication(): boolean;
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -10956,8 +10956,8 @@
|
|||||||
"from": "github:standardnotes/sncrypto#8794c88daa967eaae493cd5fdec7506d52b257ad"
|
"from": "github:standardnotes/sncrypto#8794c88daa967eaae493cd5fdec7506d52b257ad"
|
||||||
},
|
},
|
||||||
"snjs": {
|
"snjs": {
|
||||||
"version": "github:standardnotes/snjs#2d44b98e3dfd1fa7fe4f83665d663d01063333c1",
|
"version": "github:standardnotes/snjs#403dd0ccd860c42889601446540a9e17b8f7440f",
|
||||||
"from": "github:standardnotes/snjs#2d44b98e3dfd1fa7fe4f83665d663d01063333c1"
|
"from": "github:standardnotes/snjs#403dd0ccd860c42889601446540a9e17b8f7440f"
|
||||||
},
|
},
|
||||||
"sockjs": {
|
"sockjs": {
|
||||||
"version": "0.3.20",
|
"version": "0.3.20",
|
||||||
|
|||||||
@@ -69,6 +69,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"sncrypto": "github:standardnotes/sncrypto#8794c88daa967eaae493cd5fdec7506d52b257ad",
|
"sncrypto": "github:standardnotes/sncrypto#8794c88daa967eaae493cd5fdec7506d52b257ad",
|
||||||
"snjs": "github:standardnotes/snjs#2d44b98e3dfd1fa7fe4f83665d663d01063333c1"
|
"snjs": "github:standardnotes/snjs#403dd0ccd860c42889601446540a9e17b8f7440f"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user