コード例 #1
0
ファイル: User.cs プロジェクト: Morebis-GIT/CI
        public static User Create(
            int id,
            string name,
            string surname,
            string email,
            string plainTextPassword,
            string themeName,
            string location,
            string role,
            int tenantId,
            string defaultTimeZone
            )
        {
            Validate(name,
                     surname,
                     email,
                     plainTextPassword,
                     tenantId);

            var user = new User()
            {
                Id              = id,
                Name            = name,
                Surname         = surname,
                Email           = email,
                Password        = plainTextPassword == null ? null : UserPassword.Hash(plainTextPassword),
                ThemeName       = themeName,
                Location        = location,
                Role            = role,
                TenantId        = tenantId,
                DefaultTimeZone = defaultTimeZone,
            };

            return(user);
        }
コード例 #2
0
ファイル: User.cs プロジェクト: Morebis-GIT/CI
        public void ChangePassword(
            string plainTextPassword,
            List <string> bannedPasswordLiteralList,
            List <string> bannedPasswordPatternList)
        {
            // Validate format
            UserPassword.ValidateFormat(plainTextPassword);

            // Validate banned list
            UserPassword.ValidateOnBannedList(plainTextPassword, bannedPasswordLiteralList, bannedPasswordPatternList);

            // Set password
            Password = UserPassword.Hash(plainTextPassword);
        }