Пример #1
0
        public async Task<LoginResult> AuthenticateAsync(FacebookAccount account, RemoteUser user)
        {
            var facebookUser = GetFacebookUserInfo(account.Token);

            if (!Validate(facebookUser, account.FacebookUserId, account.Email))
            {
                return new LoginResult
                {
                    Status = false,
                    Message = "Access is denied"
                };
            }

            var 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-email-other.html";
                    var welcomeEmail = new WelcomeEmail(facebookUser, template, ProviderName);
                    await welcomeEmail.SendAsync();
                }
            }
            return result;
        }
Пример #2
0
        public async Task<ActionResult> ConfirmAsync(string token)
        {
            Guid id = token.To<Guid>();

            if (!DAL.Registration.ConfirmRegistration(id))
            {
                return View(GetRazorView<AreaRegistration>("SignUp/InvalidToken.cshtml"));
            }

            DTO.Registration registration = DAL.Registration.Get(id);
            WelcomeEmail email = new WelcomeEmail(registration);
            await email.SendAsync();

            return View(GetRazorView<AreaRegistration>("SignUp/Welcome.cshtml"));
        }