コード例 #1
0
        public async Task <ActionResult> ResetLink(PasswordResetLinkRequest request)
        {
            var user = db.GetUserByEmail(request.Email);

            if (user == null)
            {
                return(new NotFoundObjectResult("Account not found"));
            }

            user.EmailToken = Security.GeneratePasswordResetIdentifier();
            db.UpdateUser(user);

            await emailService.Reset(user);

            return(Ok());
        }
コード例 #2
0
        public async Task <ActionResult> ResetLink(PasswordResetLinkRequest request)
        {
            var user = db.GetUserByEmail(request.Email);

            if (user == null)
            {
                return(new NotFoundObjectResult("Account not found"));
            }

            // send an email with a link back to the app containing a verification token
            // TODO: if it matters you could store and check a time for the reset request to restrict the reset to a time window
            user.EmailToken = Security.GeneratePasswordResetIdentifier();
            db.UpdateUser(user);

            await emailService.Reset(user);

            return(Ok());
        }