Exemplo n.º 1
0
        //public async Task<CompanyUser> Login(string mail, string password)
        //{
        //    if (password == null)
        //    {
        //        throw new ArgumentNullException(nameof(password));
        //    }

        //    await _companyUserContext.ApiLoginAsync(mail, password);

        //    CompanyUser customerUser = new CompanyUser();

        //    customerUser = new CompanyUser(await _companyUserContext.ApiGetCustomerTokenAsync());

        //    //string hash = _CustomerUserContext.GetCustomerUserHashedPassword(mail);

        //    return customerUser;
        //}

        public async Task <CompanyUser> Login(string mail, string password, int?pin)
        {
            if (password == null)
            {
                throw new ArgumentNullException(nameof(password));
            }

            await _companyUserContext.ApiGetCompanyUserToken(mail, password, pin);

            CompanyUser customerUser = new CompanyUser();

            customerUser = new CompanyUser(await _companyUserContext.ApiGetCompanyuserAsync());

            //string hash = _CustomerUserContext.GetCustomerUserHashedPassword(mail);

            return(customerUser);
        }
Exemplo n.º 2
0
        public async Task <User> Login(string mail, string password)
        {
            if (password == null)
            {
                throw new ArgumentNullException(nameof(password));
            }

            CompanyUser companyUser = new CompanyUser();

            //Set OAuth1 token in the session.
            await _UserContext.ApiLoginAsync(mail, password);

            var test = await _UserContext.ApiGetCustomerTokenAsync();

            companyUser = new CompanyUser(test);

            return(companyUser);
        }