Ejemplo n.º 1
0
        public async Task <ActionResult> VerifyCode(string provider, string returnUrl, bool rememberMe)
        {
            // Require that the user has already logged in via username/password or external login
            if (!await SignInManager.HasBeenVerifiedAsync())
            {
                return(View("Error"));
            }
            var user = await UserManager.FindByIdAsync(await SignInManager.GetVerifiedUserIdAsync());

            if (user != null)
            {
                var code = await UserManager.GenerateTwoFactorTokenAsync(user.Id, provider);
            }
            return(View(new VerifyCodeViewModel {
                Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe
            }));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> VerifyCode(string provider, string returnUrl, bool rememberMe)
        {
            // 要求用户已通过使用用户名/密码或外部登录名登录
            if (!await SignInManager.HasBeenVerifiedAsync())
            {
                return(View("Error"));
            }
            var user = await UserManager.FindByIdAsync(await SignInManager.GetVerifiedUserIdAsync());

            if (user != null)
            {
                var code = await UserManager.GenerateTwoFactorTokenAsync(user.Id, provider);
            }
            return(View(new VerifyCodeViewModel {
                Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe
            }));
        }
        public virtual async Task <ActionResult> VerifyCode(string provider, string returnUrl)
        {
            // Require that the user has already logged in via username/password or external login
            if (!await SignInManager.HasBeenVerifiedAsync())
            {
                return(View("Error"));
            }
            var user = await UserManager.FindByIdAsync(await SignInManager.GetVerifiedUserIdAsync());

            if (user != null)
            {
                ViewBag.Status = "For DEMO purposes the current " + provider + " code is: " + await UserManager.GenerateTwoFactorTokenAsync(user.Id, provider);
            }
            return(View(new VerifyCodeViewModel {
                Provider = provider, ReturnUrl = returnUrl
            }));
        }
        public async Task <ActionResult> VerifyCode(string provider, string returnUrl, bool rememberMe)
        {
            // ユーザーがユーザー名/パスワードまたは外部ログイン経由でログイン済みであることが必要です。
            if (!await SignInManager.HasBeenVerifiedAsync())
            {
                return(View("Error"));
            }
            var user = await UserManager.FindByIdAsync(await SignInManager.GetVerifiedUserIdAsync());

            if (user != null)
            {
                var code = await UserManager.GenerateTwoFactorTokenAsync(user.Id, provider);
            }
            return(View(new VerifyCodeViewModel {
                Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe
            }));
        }
Ejemplo n.º 5
0
        public async Task <ActionResult> VerifyCode(string provider, string returnUrl, bool rememberMe)
        {
            // Vyžaduje, aby uživatel již byl přihlášen pomocí uživatelského jména/hesla nebo externího přihlášení.
            if (!await SignInManager.HasBeenVerifiedAsync())
            {
                return(View("Error"));
            }
            var user = await UserManager.FindByIdAsync(await SignInManager.GetVerifiedUserIdAsync());

            if (user != null)
            {
                var code = await UserManager.GenerateTwoFactorTokenAsync(user.Id, provider);
            }
            return(View(new VerifyCodeViewModel {
                Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe
            }));
        }
Ejemplo n.º 6
0
        public async Task <ActionResult> VerifyCode(string provider, string returnUrl, bool rememberMe)
        {
            // Nécessiter que l'utilisateur soit déjà connecté via un nom d'utilisateur/mot de passe ou une connexte externe
            if (!await SignInManager.HasBeenVerifiedAsync())
            {
                return(View("Error"));
            }
            var user = await UserManager.FindByIdAsync(await SignInManager.GetVerifiedUserIdAsync());

            if (user != null)
            {
                var code = await UserManager.GenerateTwoFactorTokenAsync(user.Id, provider);
            }
            return(View(new VerifyCodeViewModel {
                Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe
            }));
        }
        public async Task <ActionResult> VerifyCode(string provider, string returnUrl, bool rememberMe)
        {
            // Requerir que el usuario haya iniciado sesión con nombre de usuario y contraseña o inicio de sesión externo
            if (!await SignInManager.HasBeenVerifiedAsync())
            {
                return(View("Error"));
            }
            var user = await UserManager.FindByIdAsync(await SignInManager.GetVerifiedUserIdAsync());

            if (user != null)
            {
                var code = await UserManager.GenerateTwoFactorTokenAsync(user.Id, provider);
            }
            return(View(new VerifyCodeViewModel {
                Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe
            }));
        }
Ejemplo n.º 8
0
        public async Task <ActionResult> VerifyCode(string provider, string returnUrl, bool rememberMe)
        {
            // Требовать предварительный вход пользователя с помощью имени пользователя и пароля или внешнего имени входа
            if (!await SignInManager.HasBeenVerifiedAsync())
            {
                return(View("Error"));
            }
            var user = await UserManager.FindByIdAsync(await SignInManager.GetVerifiedUserIdAsync());

            if (user != null)
            {
                var code = await UserManager.GenerateTwoFactorTokenAsync(user.Id, provider);
            }
            return(View(new VerifyCodeViewModel {
                Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe
            }));
        }
Ejemplo n.º 9
0
        public async Task <ActionResult> VerifyCode(string provider, string returnUrl, bool rememberMe)
        {
            // Verlangen, dass sich der Benutzer bereits mit seinem Benutzernamen/Kennwort oder einer externen Anmeldung angemeldet hat.
            if (!await SignInManager.HasBeenVerifiedAsync())
            {
                return(View("Error"));
            }
            var user = await UserManager.FindByIdAsync(await SignInManager.GetVerifiedUserIdAsync());

            if (user != null)
            {
                var code = await UserManager.GenerateTwoFactorTokenAsync(user.Id, provider);
            }
            return(View(new VerifyCodeViewModel {
                Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe
            }));
        }
Ejemplo n.º 10
0
        public async Task <ActionResult> VerifyCode(string provider, string returnUrl, string userId)
        {
            // Requer que o usuario já tenha feito um login por senha.
            if (!await SignInManager.HasBeenVerifiedAsync())
            {
                return(View("Error"));
            }
            var user = await UserManager.FindByIdAsync(await SignInManager.GetVerifiedUserIdAsync());

            if (user != null)
            {
                ViewBag.Status       = "DEMO: Caso o código não chegue via " + provider + " o código é: ";
                ViewBag.CodigoAcesso = await UserManager.GenerateTwoFactorTokenAsync(user.Id, provider);
            }
            return(View(new VerifyCodeViewModel {
                Provider = provider, ReturnUrl = returnUrl, UserId = userId
            }));
        }
Ejemplo n.º 11
0
        public async Task <ActionResult> VerifyCode(string provider, string returnUrl, string userId)
        {
            // Requerys that the user has made um login using his password
            if (!await signInManager.HasBeenVerifiedAsync())
            {
                return(View("Error"));
            }
            var user = await userManager.FindByIdAsync(await signInManager.GetVerifiedUserIdAsync());

            if (user != null)
            {
                ViewBag.Status       = "DEMO: In case the code has not arrived through " + provider + " the code is: ";
                ViewBag.CodigoAcesso = await userManager.GenerateTwoFactorTokenAsync(user.Id, provider);
            }
            return(View(new VerifyCodeViewModel {
                Provider = provider, ReturnUrl = returnUrl, UserId = userId
            }));
        }
Ejemplo n.º 12
0
        public async Task <ActionResult> VerifyCode(string provider, string returnUrl, bool rememberMe)
        {
            // Require that the AppMember has already logged in via username/password or external login
            if (!await SignInManager.HasBeenVerifiedAsync())
            {
                DemLogger.Current.Error($"{nameof(AdministrationController)}. GET Action VerifyCode: SignInManager.HasBeenVerifiedAsync() return false");
                return(View("Error"));
            }
            var appMember = await UserManager.FindByIdAsync(await SignInManager.GetVerifiedUserIdAsync());

            if (appMember != null)
            {
                await UserManager.GenerateTwoFactorTokenAsync(appMember.Id, provider);
            }
            return(View(new VerifyCodeViewModel {
                Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe
            }));
        }
Ejemplo n.º 13
0
        public async Task <IHttpActionResult> VerifyCode(string provider, string returnUrl, bool rememberMe)
        {
            if (!await _AppSignInManager.HasBeenVerifiedAsync())
            {
                return(BadRequest("Error"));
            }
            var user = await _AppUserManager.FindByIdAsync(await _AppSignInManager.GetVerifiedUserIdAsync());

            if (user != null)
            {
                var status       = "DEMO: Caso o código não chegue via " + provider + " o código é: ";
                var codigoAcesso = await _AppUserManager.GenerateTwoFactorTokenAsync(user.Id, provider);

                return(Ok(status + codigoAcesso));
            }
            return(Ok(new VerifyCode {
                Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe
            }));
        }
Ejemplo n.º 14
0
        public async Task <ActionResult> VerifyCode(string provider, string returnUrl, bool rememberMe, string invitationCode)
        {
            // Require that the user has already logged in via username/password or external login
            if (!await SignInManager.HasBeenVerifiedAsync())
            {
                return(HttpNotFound());
            }

            if (ViewBag.Settings.IsDemoMode)
            {
                var user = await UserManager.FindByIdAsync(await SignInManager.GetVerifiedUserIdAsync());

                if (user != null && user.LogonEnabled)
                {
                    var code = await UserManager.GenerateTwoFactorTokenAsync(user.Id, provider);

                    ViewBag.DemoModeCode = code;
                }
            }

            return(View(new VerifyCodeViewModel {
                Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe, InvitationCode = invitationCode
            }));
        }
Ejemplo n.º 15
0
 public async Task <bool> HasBeenVerifiedAsync()
 {
     return(await ApplicationSignInManager.HasBeenVerifiedAsync());
 }
Ejemplo n.º 16
0
 public async Task <bool> UsuarioVerificado()
 {
     return(await _signInManager.HasBeenVerifiedAsync());
 }