Merge pull request #3102 from NoelDeMartin/MOBILE-3316
MOBILE-3316 core: Fix nologin & suspended stringsmain
commit
6e976570f7
|
@ -2340,6 +2340,7 @@
|
||||||
"core.userdeleted": "moodle",
|
"core.userdeleted": "moodle",
|
||||||
"core.userdetails": "moodle",
|
"core.userdetails": "moodle",
|
||||||
"core.usernotfullysetup": "error",
|
"core.usernotfullysetup": "error",
|
||||||
|
"core.usernologin": "local_moodlemobileapp",
|
||||||
"core.users": "moodle",
|
"core.users": "moodle",
|
||||||
"core.usersuspended": "tool_reportbuilder",
|
"core.usersuspended": "tool_reportbuilder",
|
||||||
"core.view": "moodle",
|
"core.view": "moodle",
|
||||||
|
|
|
@ -631,6 +631,12 @@ export class CoreSite {
|
||||||
CoreEvents.trigger(CoreEvents.USER_SUSPENDED, { params: data }, this.id);
|
CoreEvents.trigger(CoreEvents.USER_SUSPENDED, { params: data }, this.id);
|
||||||
error.message = Translate.instant('core.usersuspended');
|
error.message = Translate.instant('core.usersuspended');
|
||||||
|
|
||||||
|
throw new CoreWSError(error);
|
||||||
|
} else if (error.errorcode === 'wsaccessusernologin') {
|
||||||
|
// User suspended, trigger event.
|
||||||
|
CoreEvents.trigger(CoreEvents.USER_NO_LOGIN, { params: data }, this.id);
|
||||||
|
error.message = Translate.instant('core.usernologin');
|
||||||
|
|
||||||
throw new CoreWSError(error);
|
throw new CoreWSError(error);
|
||||||
} else if (error.errorcode === 'forcepasswordchangenotice') {
|
} else if (error.errorcode === 'forcepasswordchangenotice') {
|
||||||
// Password Change Forced, trigger event. Try to get data from cache, the event will handle the error.
|
// Password Change Forced, trigger event. Try to get data from cache, the event will handle the error.
|
||||||
|
|
|
@ -63,6 +63,7 @@ export class CoreUserProvider {
|
||||||
|
|
||||||
CoreEvents.on(CoreEvents.USER_DELETED, data => this.handleUserKickedOutEvent(data));
|
CoreEvents.on(CoreEvents.USER_DELETED, data => this.handleUserKickedOutEvent(data));
|
||||||
CoreEvents.on(CoreEvents.USER_SUSPENDED, data => this.handleUserKickedOutEvent(data));
|
CoreEvents.on(CoreEvents.USER_SUSPENDED, data => this.handleUserKickedOutEvent(data));
|
||||||
|
CoreEvents.on(CoreEvents.USER_NO_LOGIN, data => this.handleUserKickedOutEvent(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -327,7 +327,8 @@
|
||||||
"userdeleted": "This user account has been deleted",
|
"userdeleted": "This user account has been deleted",
|
||||||
"userdetails": "User details",
|
"userdetails": "User details",
|
||||||
"usernotfullysetup": "User not fully set-up",
|
"usernotfullysetup": "User not fully set-up",
|
||||||
"usersuspended": "This user account has been suspended",
|
"usernologin": "Authentication has been revoked for this account",
|
||||||
|
"usersuspended": "Registration suspended",
|
||||||
"users": "Users",
|
"users": "Users",
|
||||||
"view": "View",
|
"view": "View",
|
||||||
"viewcode": "View code",
|
"viewcode": "View code",
|
||||||
|
|
|
@ -45,6 +45,7 @@ export interface CoreEventsData {
|
||||||
[CoreEvents.PACKAGE_STATUS_CHANGED]: CoreEventPackageStatusChanged;
|
[CoreEvents.PACKAGE_STATUS_CHANGED]: CoreEventPackageStatusChanged;
|
||||||
[CoreEvents.USER_DELETED]: CoreEventUserDeletedData;
|
[CoreEvents.USER_DELETED]: CoreEventUserDeletedData;
|
||||||
[CoreEvents.USER_SUSPENDED]: CoreEventUserSuspendedData;
|
[CoreEvents.USER_SUSPENDED]: CoreEventUserSuspendedData;
|
||||||
|
[CoreEvents.USER_NO_LOGIN]: CoreEventUserNoLoginData;
|
||||||
[CoreEvents.FORM_ACTION]: CoreEventFormActionData;
|
[CoreEvents.FORM_ACTION]: CoreEventFormActionData;
|
||||||
[CoreEvents.NOTIFICATION_SOUND_CHANGED]: CoreEventNotificationSoundChangedData;
|
[CoreEvents.NOTIFICATION_SOUND_CHANGED]: CoreEventNotificationSoundChangedData;
|
||||||
[CoreEvents.SELECT_COURSE_TAB]: CoreEventSelectCourseTabData;
|
[CoreEvents.SELECT_COURSE_TAB]: CoreEventSelectCourseTabData;
|
||||||
|
@ -87,6 +88,7 @@ export class CoreEvents {
|
||||||
static readonly COMPLETION_CHANGED = 'completion_changed';
|
static readonly COMPLETION_CHANGED = 'completion_changed';
|
||||||
static readonly USER_DELETED = 'user_deleted';
|
static readonly USER_DELETED = 'user_deleted';
|
||||||
static readonly USER_SUSPENDED = 'user_suspended';
|
static readonly USER_SUSPENDED = 'user_suspended';
|
||||||
|
static readonly USER_NO_LOGIN = 'user_no_login';
|
||||||
static readonly PACKAGE_STATUS_CHANGED = 'package_status_changed';
|
static readonly PACKAGE_STATUS_CHANGED = 'package_status_changed';
|
||||||
static readonly COURSE_STATUS_CHANGED = 'course_status_changed';
|
static readonly COURSE_STATUS_CHANGED = 'course_status_changed';
|
||||||
static readonly SECTION_STATUS_CHANGED = 'section_status_changed';
|
static readonly SECTION_STATUS_CHANGED = 'section_status_changed';
|
||||||
|
@ -315,6 +317,14 @@ export type CoreEventUserSuspendedData = {
|
||||||
params: any; // Params sent to the WS that failed.
|
params: any; // Params sent to the WS that failed.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data passed to USER_NO_LOGIN event.
|
||||||
|
*/
|
||||||
|
export type CoreEventUserNoLoginData = {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
params: any; // Params sent to the WS that failed.
|
||||||
|
};
|
||||||
|
|
||||||
export enum CoreEventFormAction {
|
export enum CoreEventFormAction {
|
||||||
CANCEL = 'cancel',
|
CANCEL = 'cancel',
|
||||||
SUBMIT = 'submit',
|
SUBMIT = 'submit',
|
||||||
|
|
Loading…
Reference in New Issue