public IActionResult Index() { IndexView model = new IndexView(Context.HttpContext); if (User.Identity.IsAuthenticated) { string accountSource = CookieUtil.GetCookie(AccountSource.LoginSource, User); if (accountSource == AccountSource.Git) { //直接返回cookie中的结果,并建立session model.User = _signService.GetGitUser(); model.IsLogin = true; } } else { model.IsLogin = false; } return(View(model)); }
public async Task <UserView> SigninByGit(GitSignInPara data) { UserView user = new UserView(); if (User.Identity.IsAuthenticated) { string accountSource = CookieUtil.GetCookie(AccountSource.LoginSource, User); if (accountSource == AccountSource.Git) { //直接返回cookie中的结果,并建立session user = SignInService.GetGitUser(); } } else { //没有授权 先获取授权,插入自己的库,再加cookie user = await SignInService.OauthFromGit(data); } return(user); }