Exemplo n.º 1
0
 public override void SetInputErrorMessages()
 {
     if (UserUid.IsEmptyGuid())
     {
         ErrorMessages.Add("user_uid_is_not_valid");
     }
 }
Exemplo n.º 2
0
        public override void SetInputErrorMessages()
        {
            if (UserUid.IsEmptyGuid())
            {
                ErrorMessages.Add("organization_uid_not_valid");
            }

            FirstName = FirstName.TrimOrDefault();
            if (FirstName.IsEmpty())
            {
                FirstNameInput.ErrorMessage.Add("first_name_required_error_massage");
                InputErrorMessages.AddRange(FirstNameInput.ErrorMessage);
            }

            LastName = LastName.TrimOrDefault();
            if (LastName.IsEmpty())
            {
                LastNameInput.ErrorMessage.Add("last_name_required_error_massage");
                InputErrorMessages.AddRange(LastNameInput.ErrorMessage);
            }

            if (LanguageUid.IsEmptyGuid())
            {
                LanguageInput.ErrorMessage.Add("language_uid_not_valid");
                InputErrorMessages.AddRange(LanguageInput.ErrorMessage);
            }
        }
Exemplo n.º 3
0
        public override void SetInputModelValues()
        {
            UserUidInput.Value = UserUid.ToUidString();

            OldPasswordInput.Value        = OldPassword;
            NewPasswordInput.Value        = NewPassword;
            ReEnterNewPasswordInput.Value = ReEnterNewPassword;
        }
Exemplo n.º 4
0
        public override void SetInputModelValues()
        {
            UserUidInput.Value = UserUid.ToUidString();

            FirstNameInput.Value = FirstName;
            LastNameInput.Value  = LastName;

            if (LanguageUid.IsNotEmptyGuid())
            {
                LanguageInput.Value = LanguageUid.ToUidString();
                LanguageInput.Text  = LanguageName;
            }
        }
Exemplo n.º 5
0
        public HttpMessage <UserWithRole> LoginCheck(UserUid uu)
        {
            return(TryCatchResponse(() =>
            {
                UserWithRole result = new UserWithRole()
                {
                    Id = uu.User
                };
                User user = GetUser(uu.User);

                if (user != null && user.D == 0)
                {
                    result.Email = user.Email;
                    result.Roles = GetUserRoles(user.Id);
                }
                return CreateResponseOk(result);
            }));
        }
Exemplo n.º 6
0
        internal static UserUid GetUserUid(string uid)
        {
            UserUid result = new UserUid();

            AppSettings.Query.Basket.Execute(@"[get_user_uid]"
                                             , sqlParameters: new SqlParameter[]
            {
                new SqlParameter("@Uid", string.IsNullOrEmpty(uid) ? (object)DBNull.Value : uid),
            }
                                             , onExecute: null
                                             , action: (values) =>
            {
                result.Id   = values[0].ToInt();
                result.Uid  = values[1].ToStr();
                result.User = values[2].ToInt();
            });
            return(result);
        }
        public async Task <HttpMessage <UidResult> > Uid(string uid)
        => await TryCatchResponseAsync(async() =>
        {
            return(await Task.Run(() =>
            {
                Principal principal = Core.Http.HttpContext.Current.User as Principal;
                UserWithRole user = null;
                if (principal == null || principal.User == null)
                {
                    UserUid uu = GetUserUid(uid);
                    HttpMessage <UserWithRole> postResult = Json.Post <HttpMessage <UserWithRole>, UserUid>(AppSettings.AccountService.Server, AppSettings.AccountService.ApiAccount + "/loginCheck", uu);
                    user = postResult?.Data;
                }
                else
                {
                    user = (principal.User as UserWithRole);
                }

                if (principal == null && user != null && user.Id != 0)
                {
                    principal = new Principal(user);
                    AuthUserManager.LogIn(principal);
                }

                int userId = user.Id;
                int siteUserId = SetUserUid(uid, userId);

                bool Cms = user.Roles != null && user.Roles.Count > 0 && user.Roles.FirstOrDefault(f => f.Role == 1) != null;
                bool auth = user != null && user.Id != 0;
                string version = this.GetType().Assembly.GetCustomAttribute <AssemblyFileVersionAttribute>().Version;
                return CreateResponseOk(new UidResult()
                {
                    Version = version, Identity = new IdentityResult {
                        SiteUserId = siteUserId, Auth = auth, Cms = Cms, Token = principal == null ? "" : principal.GetKey(), User = user
                    }
                });
            }));
        });
Exemplo n.º 8
0
        public override void SetInputErrorMessages()
        {
            if (UserUid.IsEmptyGuid())
            {
                ErrorMessages.Add("user_uid_is_not_valid_error_message");
            }

            OldPassword = OldPassword.TrimOrDefault();
            if (OldPassword.IsEmpty())
            {
                OldPasswordInput.ErrorMessage.Add("old_password_required_error_message");
                InputErrorMessages.AddRange(OldPasswordInput.ErrorMessage);
            }

            NewPassword = NewPassword.TrimOrDefault();
            if (NewPassword.IsEmpty())
            {
                NewPasswordInput.ErrorMessage.Add("new_password_required_error_message");
                InputErrorMessages.AddRange(NewPasswordInput.ErrorMessage);
            }

            ReEnterNewPassword = ReEnterNewPassword.TrimOrDefault();
            if (ReEnterNewPassword.IsEmpty())
            {
                ReEnterNewPasswordInput.ErrorMessage.Add("re_entered_password_required_error_message");
                InputErrorMessages.AddRange(ReEnterNewPasswordInput.ErrorMessage);
            }

            OldPassword = OldPassword.TrimOrDefault();
            if (OldPassword.IsNotValidPassword())
            {
                OldPasswordInput.ErrorMessage.Add("old_password_is_not_valid_error_message");
                InputErrorMessages.AddRange(OldPasswordInput.ErrorMessage);
            }

            NewPassword = NewPassword.TrimOrDefault();
            if (NewPassword.IsNotValidPassword())
            {
                NewPasswordInput.ErrorMessage.Add("new_password_is_not_valid_error_message");
                InputErrorMessages.AddRange(NewPasswordInput.ErrorMessage);
            }

            ReEnterNewPassword = ReEnterNewPassword.TrimOrDefault();
            if (ReEnterNewPassword.IsNotValidPassword())
            {
                ReEnterNewPasswordInput.ErrorMessage.Add("re_entered_password_is_not_valid_error_message");
                InputErrorMessages.AddRange(ReEnterNewPasswordInput.ErrorMessage);
            }

            OldPassword = OldPassword.TrimOrDefault();
            if (OldPassword == NewPassword)
            {
                NewPasswordInput.ErrorMessage.Add("new_password_can_not_same_as_old_password_error_message");
                InputErrorMessages.AddRange(NewPasswordInput.ErrorMessage);
            }

            NewPassword = NewPassword.TrimOrDefault();
            if (NewPassword != ReEnterNewPassword)
            {
                ReEnterNewPasswordInput.ErrorMessage.Add("re_entered_password_does_not_match_error_message");
                InputErrorMessages.AddRange(ReEnterNewPasswordInput.ErrorMessage);
            }
        }
Exemplo n.º 9
0
 public override void SetInputModelValues()
 {
     UserUidInput.Value = UserUid.ToUidString();
 }