cloud-ide-model-schema
Version:
Pachage for schema management of Cloud IDEsys LMS
63 lines (62 loc) • 2.76 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MForgotPassword = void 0;
/* INTERFACE END */
/* MODEL START */
var MForgotPassword = /** @class */ (function () {
function MForgotPassword(init) {
Object.assign(this, init);
}
MForgotPassword.prototype.Validate = function () {
var _a, _b, _c;
var errorLogger = {};
/* Check method set or not */
if (!this.custom_forgot_password_method) {
errorLogger.custom_forgot_password_method = "Forgot Password Method is Required!";
}
else {
if (this.custom_forgot_password_method == "username") {
/* if username is selected by user */
if (this.user_username) {
/* Check wether length is in between 8 to 20 or not */
if (((_a = this.user_username) === null || _a === void 0 ? void 0 : _a.length) < 8 || ((_b = this.user_username) === null || _b === void 0 ? void 0 : _b.length) > 20) {
errorLogger.user_username = "Username is Invalid!";
}
}
else {
errorLogger.user_username = "Username is Required!";
}
}
else if (this.custom_forgot_password_method == "email") {
/* if email is selected by user */
if (this.user_emailid) {
/* Check wether length is 8 to 50 or not */
if (((_c = this.user_emailid) === null || _c === void 0 ? void 0 : _c.length) < 8 || this.user_emailid.length > 50) {
errorLogger.user_emailid = "Email Id is Invalid!";
}
}
else {
errorLogger.user_emailid = "Email Id is Required!";
}
}
else if (this.custom_forgot_password_method == "mobile") {
/* if mobile is selected by user */
if (this.user_mobileno) {
/* Check wether length is 10 to 15 digits or not */
if (this.user_mobileno < 1000000000 || this.user_mobileno > 999999999999999) {
errorLogger.user_mobileno = "Mobile Number is Invalid!";
}
}
else {
errorLogger.user_mobileno = "Mobile Number is Required!";
}
}
else {
errorLogger.custom_forgot_password_method = "Forgot Password Method is Invalid, please use 'username' or 'email' or 'mobile'";
}
}
return errorLogger;
};
return MForgotPassword;
}());
exports.MForgotPassword = MForgotPassword;