From ec08e3258e165c45f8aadfa9feac8e2a482697a0 Mon Sep 17 00:00:00 2001 From: birendra.kumar Date: Wed, 22 Jan 2020 17:15:26 +0530 Subject: [PATCH] user validation fixed --- 400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs | 4 ++-- 400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserGroupController.cs | 6 +++--- 400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserGroupModel.cs | 6 +++--- 400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs | 3 ++- 400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js | 2 +- 400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.ts | 6 +++--- 400-SOURCECODE/Admin/src/app/components/LicenseEntity/searchlicense.component.ts | 4 ++-- 400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.html | 6 +++++- 400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.ts | 20 +++++++++++--------- 400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.html | 5 ++++- 400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts | 29 +++++++++++++++-------------- 11 files changed, 51 insertions(+), 40 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs index 85d9160..af55c23 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs @@ -49,9 +49,9 @@ namespace AIAHTML5.ADMIN.API.Controllers { dbContext.Configuration.ProxyCreationEnabled = false; try - { + { return Ok(dbContext.AIAUsers.Where(u => u.Id == userId).Select(s => new UserModel { - DeactivationDate=s.DeactivationDate.Value, + DeactivationDate=s.DeactivationDate, Createdby = dbContext.AIAUsers.Where(sub1 => sub1.Id == s.CreatorId).Select(sub1 => sub1.FirstName ).FirstOrDefault()+ " "+ dbContext.AIAUsers.Where(sub1 => sub1.Id == s.CreatorId).Select(sub1 => sub1.LastName).FirstOrDefault(), Modifiedby = dbContext.AIAUsers.Where(sub1 => sub1.Id == s.ModifierId).Select(sub1 => sub1.FirstName ).FirstOrDefault() + " " + dbContext.AIAUsers.Where(sub1 => sub1.Id == s.ModifierId).Select(sub1 => sub1.LastName).FirstOrDefault() }).ToList()); diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserGroupController.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserGroupController.cs index c6c4b8a..0f804ed 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserGroupController.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserGroupController.cs @@ -24,7 +24,7 @@ namespace AIAHTML5.ADMIN.API.Controllers [Route("LicenseUserGroups")] [HttpGet] - public HttpResponseMessage GetLicenseUserGroups(int LicenseId, int pageNo, int pageLength) + public HttpResponseMessage GetLicenseUserGroups(int? LicenseId, int pageNo, int pageLength) { List UserGroupList = new List(); int recordCount = 0; @@ -42,7 +42,7 @@ namespace AIAHTML5.ADMIN.API.Controllers [Route("LicenseUserGroupUsers")] [HttpGet] - public HttpResponseMessage GetLicenseUserGroupUsers(int LicenseId, int UserGroupId, bool AllUsers, int pageNo, int pageLength) + public HttpResponseMessage GetLicenseUserGroupUsers(int? LicenseId, int UserGroupId, bool AllUsers, int pageNo, int pageLength) { List UserList = new List(); int recordCount = 0; @@ -142,7 +142,7 @@ namespace AIAHTML5.ADMIN.API.Controllers [Route("CheckDuplicateLicenseUserGroup")] [HttpGet] - public HttpResponseMessage CheckDuplicateLicenseUserGroup(int LicenseId, string Title) + public HttpResponseMessage CheckDuplicateLicenseUserGroup(int? LicenseId, string Title) { bool Status = false; try diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserGroupModel.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserGroupModel.cs index e94868a..e0a646f 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserGroupModel.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserGroupModel.cs @@ -16,7 +16,7 @@ namespace AIAHTML5.ADMIN.API.Models public bool? IsActive { get; set; } public int? TotalUsers { get; set; } - public static List GetLicenseUserGroups(AIADatabaseV5Entities dbContext, int LicenseId, int pageNo, int pageLength, out int recordCount) + public static List GetLicenseUserGroups(AIADatabaseV5Entities dbContext, int? LicenseId, int pageNo, int pageLength, out int recordCount) { List UserGroupList = new List(); UserGroupModel UserGroupObj = new UserGroupModel(); @@ -43,7 +43,7 @@ namespace AIAHTML5.ADMIN.API.Models return UserGroupList; } - public static List GetLicenseUserGroupUsers(AIADatabaseV5Entities dbContext, int LicenseId, int UserGroupId, bool AllUsers, int pageNo, int pageLength, out int recordCount) + public static List GetLicenseUserGroupUsers(AIADatabaseV5Entities dbContext, int? LicenseId, int UserGroupId, bool AllUsers, int pageNo, int pageLength, out int recordCount) { List UserList = new List(); UserModel UserModelObj = new UserModel(); @@ -113,7 +113,7 @@ namespace AIAHTML5.ADMIN.API.Models } } - public static bool CheckDuplicateLicenseUserGroup(AIADatabaseV5Entities dbContext, int LicenseId, string Title) + public static bool CheckDuplicateLicenseUserGroup(AIADatabaseV5Entities dbContext, int? LicenseId, string Title) { var spStatus = new System.Data.Objects.ObjectParameter("Status", 0); try diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs index 4758eb2..a60fded 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs @@ -19,7 +19,7 @@ namespace AIAHTML5.ADMIN.API.Models public string SecurityAnswer { get; set; } public int CreatorId { get; set; } public DateTime CreationDate { get; set; } - public DateTime DeactivationDate { get; set; } + public DateTime ? DeactivationDate { get; set; } public int ModifierId { get; set; } public DateTime ModifiedDate { get; set; } public int UserTypeId { get; set; } @@ -99,6 +99,7 @@ namespace AIAHTML5.ADMIN.API.Models try { dbContext.usp_InsertAIAUser(UserEntity.LoginId, UserEntity.Password, UserEntity.FirstName, UserEntity.LastName, (byte)UserEntity.iUserTypeId, UserEntity.EmailId, (byte)questionId, null, UserEntity.Id, UserEntity.LicenseId, (byte)EditionId, spStatus); + return spStatus.Value.ToString(); } catch(Exception ex) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index fcb29dd..7b95123 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -5741,7 +5741,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A } $rootScope.reDirectURLToAdmin = function () { - window.location.href = "Admin-UI"; + window.location.href = "Admin"; }; $rootScope.SendAdminAccessRequestMail = function (userInfo) { diff --git a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.ts b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.ts index 13918f2..44f5f64 100644 --- a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.ts +++ b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.ts @@ -35,9 +35,9 @@ export class AddLicense implements OnInit { divClass: string = ''; topPos: string = '2000px'; datePipe: DatePipe = new DatePipe('en-US'); - bsValue1: Date = new Date(); - bsValue2: Date = new Date(); - bsValue3: Date = new Date(); + bsValue1: Date = null;//new Date(); + bsValue2: Date = null;//new Date(); + bsValue3: Date = null;//new Date(); modalRef: BsModalRef; editionLoginsText: string; rowIndex: number = 0; diff --git a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/searchlicense.component.ts b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/searchlicense.component.ts index ee67869..a9d2a44 100644 --- a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/searchlicense.component.ts +++ b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/searchlicense.component.ts @@ -36,8 +36,8 @@ export class SearchLicense implements OnInit, AfterViewChecked { topPos: string = '2000px'; selectedRow: number = 0; datePipe: DatePipe = new DatePipe('en-US'); - bsValue1: Date = new Date(); - bsValue2: Date = new Date(); + bsValue1: Date = null;//new Date(); + bsValue2: Date = null;//new Date(); selectedId: number = 0; modalRef: BsModalRef; checkedRecords: Array; diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.html b/400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.html index 91e732c..bf45b20 100644 --- a/400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.html +++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.html @@ -39,7 +39,11 @@
-
Confirm Password is required
+
Confirm Password is required
+ +
+ Password not match. +
diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.ts b/400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.ts index 28eeccf..53d69d6 100644 --- a/400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.ts +++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.ts @@ -196,31 +196,33 @@ export class AddUser implements OnInit, AfterViewInit { this.alerts = ''; - if (this.adduserFrm.value.UserName == '') { + if (this.adduserFrm.value.UserName == '' ||(!this.adduserFrm.controls.UserName.valid)) + { this.alerts += 'User Name of minimum 8 characters is required.'; } - if (this.adduserFrm.value.Password == '') { + if (this.adduserFrm.value.Password == '' ||(!this.adduserFrm.controls.Password.valid )) { this.alerts += '
Password of minimum 8 characters is required.'; } if (this.adduserFrm.value.ConfirmPassword == '') { this.alerts += '
Confirm Password is required.'; } - if (this.adduserFrm.value.EmailId == '') { + if (this.adduserFrm.value.Password != this.adduserFrm.value.ConfirmPassword) { + this.alerts += '
Password and confirm password must be same'; + } + + if (this.adduserFrm.value.EmailId == '' ||(!this.adduserFrm.controls.EmailId.valid)) { this.alerts += '
Email Id is required.'; } - //if(this.LicenseTypeId!=1) - //{ + if (this.adduserFrm.value.FirstName == '') { this.alerts += '
First Name is required.'; } if (this.adduserFrm.value.LastName == '') { this.alerts += '
Last Name is required.'; } - // } - if (this.adduserFrm.value.Password != this.adduserFrm.value.ConfirmPassword) { - this.alerts += '
Password and confirm password must be same'; - } + + if (this.adduserFrm.value.AccountNumberId == '0') { this.alerts += '
Please select account number'; } diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.html b/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.html index 1ecced3..25250dd 100644 --- a/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.html +++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.html @@ -204,7 +204,10 @@
-
Confirm Password is required
+
Confirm Password is required
+
+ Password not match. +
diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts b/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts index c0cff09..cefab55 100644 --- a/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts +++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts @@ -153,16 +153,16 @@ export class UsersList implements OnInit, AfterViewChecked { ], sort: true }); - - if(document.getElementById("fixed_table_rc") != null){ + + if(document.getElementById("fixed_table_rc") != null){ document.getElementById("fixed_table_rc").remove(); var testScript = document.createElement("script"); testScript.setAttribute("id", "fixed_table_rc"); testScript.setAttribute("src", "../assets/scripts/fixed_table_rc.js"); testScript.setAttribute("type", "text/javascript"); document.body.appendChild(testScript); - } - + } + this._loadingService.HideLoading("global-loading"); //this.GetUserList(); @@ -347,29 +347,31 @@ export class UsersList implements OnInit, AfterViewChecked { } public UpdateUser() { - this.alerts = ''; - if (this.adduserFrm.value.UserName == '') { - this.alerts += 'User Name minimum 8 characters is required.'; + this.alerts = ''; + if (this.adduserFrm.value.UserName == '' ||(!this.adduserFrm.controls.UserName.valid)) + { + this.alerts += 'User Name of minimum 8 characters is required.'; } - if (this.adduserFrm.value.Password == '') { + if (this.adduserFrm.value.Password == '' ||(!this.adduserFrm.controls.Password.valid )) { this.alerts += '
Password of minimum 8 characters is required.'; } if (this.adduserFrm.value.ConfirmPassword == '') { this.alerts += '
Confirm Password is required.'; } - if (this.adduserFrm.value.EmailId == '') { + if (this.adduserFrm.value.Password != this.adduserFrm.value.ConfirmPassword) { + this.alerts += '
Password and confirm password must be same'; + } + if (this.adduserFrm.value.EmailId == '' ||(!this.adduserFrm.controls.EmailId.valid)) { this.alerts += '
Email Id is required.'; } + if (this.adduserFrm.value.FirstName == '') { this.alerts += '
First Name is required.'; } if (this.adduserFrm.value.LastName == '') { this.alerts += '
Last Name is required.'; } - if (this.adduserFrm.value.Password != this.adduserFrm.value.ConfirmPassword) { - this.alerts += '
Password and confirm password must be same'; - } - + if (this.adduserFrm.valid && this.alerts == '') { this.adduserFrm.controls['isActive'].setValue(this.adduserFrm.value.UserStatusActive) @@ -445,7 +447,6 @@ export class UsersList implements OnInit, AfterViewChecked { this._confirmService.activate("User Manage Rights Successfully updated.", "alertMsg"); this.checkedRecords = new Array(this.UserManageRightsList.length); this.UncheckedRecords = new Array(this.UserManageRightsList.length); - } //if (this.closeflag) { // this.close.emit(null); -- libgit2 0.21.4