コード例 #1
0
        public CommonResponse RandomPin(string password, int pin, int length)
        {
            try
            {
                if (length == 0)
                {
                    length = 4;
                }

                if (!CheckAuth(password, pin))
                {
                    return(InvalidAuthResponse());
                }

                var res = new RandomPasswordResponse();

                res.Password = Util.RandomPassword(new Util.RandomPasswordOptions()
                {
                    Length = length,
                    AtLeastOneUppercase = false,
                    AllowLetter         = false
                });

                return(res);
            }
            catch (Exception ex)
            {
                return(ErrorResponse(ex.Message));
            }
        }
コード例 #2
0
        public CommonResponse RandomPassword(string password, int pin, int length)
        {
            try
            {
                if (length == 0)
                {
                    length = 8;
                }

                if (!CheckAuth(password, pin))
                {
                    return(InvalidAuthResponse());
                }

                var res = new RandomPasswordResponse();

                res.Password = Util.RandomPassword(new Util.RandomPasswordOptions()
                {
                    Length     = length,
                    AvoidChars = new[] { 'I', 'l', '0', 'O' }
                });

                return(res);
            }
            catch (Exception ex)
            {
                return(ErrorResponse(ex.Message));
            }
        }