Example #1
0
        public CustomerRegisterLoginViewModel Login(WebLogin webLogin)
        {
            CustomerWebAccount             customerWebAccount             = _valkyraRegisterRepository.GetAccountForLogin(webLogin);
            CustomerRegisterLoginViewModel customerRegisterLoginViewModel = new CustomerRegisterLoginViewModel();

            customerRegisterLoginViewModel.FunctionName = "LoginResult";
            if (customerWebAccount == null)
            {
                customerRegisterLoginViewModel.ValidationResultMessage = "Username or password wrong!";
            }
            else
            {
                CustomerWebToken customerWebToken = _valkyraRegisterRepository.CreateToken(customerWebAccount);
                customerRegisterLoginViewModel.Token      = customerWebToken.Token;
                customerRegisterLoginViewModel.Expire     = customerWebToken.Expire;
                customerRegisterLoginViewModel.CustomerId = customerWebAccount.Customer.Id;
            }
            return(customerRegisterLoginViewModel);
        }