UNPKG

cloud-ide-lms-model

Version:

Package for Model management of Cloud IDEsys LMS

63 lines (62 loc) 2.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MForgotPassword = void 0; /* INTERFACE END */ /* MODEL START */ class MForgotPassword { constructor(init) { Object.assign(this, init); } Validate() { var _a, _b, _c; let 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 */ const mobileLength = this.user_mobileno.length; if (mobileLength < 10 || mobileLength > 15) { 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; } } exports.MForgotPassword = MForgotPassword;