예제 #1
0
        public User UserAuthenticate(string username, string password)
        {
            User user = null;

            try
            {
                ArrayList arUsers = Find(username);
                if ((arUsers != null) && (arUsers.Count == 1))
                {
                    User   userTmp           = (User)arUsers[0];
                    string passwordEncrypted = UtilsSecurity.encrypt(password);
                    if (userTmp.Passwd == passwordEncrypted)
                    {
                        user = userTmp;
                    }
                }
            }
            catch (Exception ex)
            {
                _hasError        = true;
                _errorMessage    = ex.Message;
                _errorStacktrace = ex.StackTrace;
            }

            return(user);
        }
예제 #2
0
        public User UserCreate(string username, string password, long user_source_id = 0)
        {
            User user = null;

            try
            {
                string passwordEncrypted = UtilsSecurity.encrypt(password);
                User   userTmp           = new User()
                {
                    Username = username, Passwd = passwordEncrypted
                };
                long lID = UserCreateOrModify(userTmp);
                if (lID > 0)
                {
                    user = UserGet(lID);
                }
            }
            catch (Exception ex)
            {
                _hasError        = true;
                _errorMessage    = ex.Message;
                _errorStacktrace = ex.StackTrace;
            }

            return(user);
        }