コード例 #1
0
        public async Task <IActionResult> CorporateSignUp([FromForm] SignUp _input)
        {
            if (ModelState.IsValid)
            {
                bool status = false;
                var  value  = HttpContext.Session.GetString(SessionToken);
                if (string.IsNullOrEmpty(value))
                {
                    string token = await getToken();

                    HttpContext.Session.SetString(SessionToken, token);
                    value = HttpContext.Session.GetString(SessionToken);
                }
                SignUpHelper helper = new SignUpHelper();
                User         _in    = await helper.GetUserInput(_input);

                User _out = await _login.AddUserDetails(value, _in);

                if (_out != null)
                {
                    status = await _login.Mail(value, _in); var claims = new[] { new Claim(ClaimTypes.UserData, _out.UserId.ToString()), new Claim(ClaimTypes.Role, _out.LookUpUserType.UserType), new Claim(ClaimTypes.PrimarySid, _out.LookUpUserTypeId.ToString()) };

                    var identity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
                    var tempData = _out;
                    await HttpContext.SignInAsync(
                        CookieAuthenticationDefaults.AuthenticationScheme,
                        new ClaimsPrincipal(identity));

                    HttpContext.Session.SetInt32(SessionUser, (int)_out.UserId);
                    HttpContext.Session.SetInt32(SessionUserType, (int)_out.LookUpUserTypeId);
                    //ModelState.AddModelError("successMsg", "Welcome " + _in.Team.TeamName + "!! . Thanks for signing up for iWAY! We're excited to have you onboard.");
                    return(RedirectToAction("CorporateIndex", "Dashboard"));
                }
            }
            return(View());
        }