示例#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)
            {
                ViewBag.Status = "For DEMO purposes the current " + provider + " code is: " + await UserManager.GenerateTwoFactorTokenAsync(user.Id, provider);
            }
            return(View(new VerifyCodeViewModel {
                Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe
            }));
        }
示例#2
0
        public async Task <ActionResult> VerificarCode(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 = "Para propositos de prueba " + provider + " el codigo es: " + 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)
        {
            // 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
            }));
        }
        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
            }));
        }
示例#5
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
            }));
        }
示例#7
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
            }));
        }
示例#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
            }));
        }
        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
            }));
        }
示例#10
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
            }));
        }
示例#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
            }));
        }
示例#12
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"));
            }
            //Güvenlik mailinin yollandığı yer
            var user = await UserManager.FindByIdAsync(await SignInManager.GetVerifiedUserIdAsync());

            if (user != null)
            {
                await UserManager.GenerateTwoFactorTokenAsync(user.Id, provider);
            }
            return(View(new VerifyCodeViewModel {
                Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe
            }));
        }
示例#13
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
            }));
        }
示例#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
            }));
        }
示例#15
0
        public async Task <ActionResult> SendCode(string returnUrl, bool rememberMe)
        {
            var userId = await SignInManager.GetVerifiedUserIdAsync();

            if (userId == null)
            {
                return(View("Error"));
            }
            var userFactors = await UserManager.GetValidTwoFactorProvidersAsync(userId);

            var factorOptions = userFactors.Select(purpose => new SelectListItem {
                Text = purpose, Value = purpose
            }).ToList();

            return(View(new SendCodeViewModel {
                Providers = factorOptions, ReturnUrl = returnUrl, RememberMe = rememberMe
            }));
        }
示例#16
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
            }));
        }
示例#17
0
 public async Task <string> GetVerifiedUserIdAsync()
 {
     return(await ApplicationSignInManager.GetVerifiedUserIdAsync());
 }
示例#18
0
        public async Task <string> GetVerifiedUserIdAsync(ApplicationSignInManager signInManager)
        {
            var userId = await signInManager.GetVerifiedUserIdAsync();

            return(userId);
        }
示例#19
0
 public async Task <string> ObterUsuarioVerificado()
 {
     return(await _signInManager.GetVerifiedUserIdAsync());
 }