public async Task <bool> ExternalResponse()
        {
            ExternalLoginInfo externalLoginInfo = await _signInManager.GetExternalLoginInfoAsync();

            if (externalLoginInfo == null)
            {
                return(false);
            }
            else
            {
                AppUser user = await _userManager.FindByNameAsync(externalLoginInfo.Principal.FindFirst(ClaimTypes.Name).Value);

                if (user == null)
                {
                    user = await _userManager.FindByEmailAsync(externalLoginInfo.Principal.FindFirst(ClaimTypes.Email).Value);
                }
                if (user == null)
                {
                    user = new AppUser
                    {
                        Email    = externalLoginInfo.Principal.FindFirst(ClaimTypes.Email).Value,
                        UserName = MetinDuzenleyici.MetinDuzelt(externalLoginInfo.Principal.FindFirst(ClaimTypes.Name).Value)
                    };
                    IdentityResult result = await _userManager.CreateAsync(user);

                    if (result.Succeeded)
                    {
                        await _userManager.AddLoginAsync(user, externalLoginInfo);
                    }
                }
                await _signInManager.SignInAsync(user, false);

                return(true);
            }
        }
Exemple #2
0
 string DosyaIsmiDuzelt(string dosyaAdi, string uzanti)
 {
     return(MetinDuzenleyici.MetinDuzelt(dosyaAdi) + uzanti);
 }