public async Task <LoginResult> AuthenticateAsync(FacebookAccount account, RemoteUser user) { FacebookUserInfo facebookUser = GetFacebookUserInfo(account.Token); if (!Validate(facebookUser, account.FacebookUserId, account.Email)) { return(new LoginResult { Status = false, Message = "Access is denied" }); } LoginResult result = FacebookSignIn.SignIn(account.FacebookUserId, account.Email, account.OfficeId, facebookUser.Name, account.Token, user.Browser, user.IpAddress, account.Culture); if (result.Status) { if (!Registration.HasAccount(account.Email)) { string template = "~/Catalogs/{catalog}/Areas/Frapid.Account/EmailTemplates/welcome-3rd-party.html"; WelcomeEmail welcomeEmail = new WelcomeEmail(facebookUser, template, ProviderName); await welcomeEmail.SendAsync(); } } return(result); }
public async Task <LoginResult> AuthenticateAsync(GoogleAccount account, RemoteUser user) { bool validationResult = Task.Run(() => ValidateAsync(account.Token)).Result; if (!validationResult) { return(new LoginResult { Status = false, Message = "Access is denied" }); } GoogleUserInfo gUser = new GoogleUserInfo { Email = account.Email, Name = account.Name }; LoginResult result = GoogleSignIn.SignIn(account.Email, account.OfficeId, account.Name, account.Token, user.Browser, user.IpAddress, account.Culture); if (result.Status) { if (!Registration.HasAccount(account.Email)) { string template = "~/Catalogs/{catalog}/Areas/Frapid.Account/EmailTemplates/welcome-3rd-party.html"; WelcomeEmail welcomeEmail = new WelcomeEmail(gUser, template, ProviderName); await welcomeEmail.SendAsync(); } } return(result); }