confirm user account
180277
def confirm
      token = params[:token].to_s

      user = User.find_by(confirmation_token: token)

      if user.present? && user.confirmation_token_valid?
        if user.mark_as_confirmed!
          render json: {status: 'Account confirmed successfully.'}
        else
          render json: user.errors, status: 422
        end
      else
        render json: ['Invalid token'], status: :not_found
      end
    end
226261
function user_confirm($username, $confirmsecret = null) {
        global $DB;

        $user = get_complete_user_data('username', $username);

        if (!empty($user)) {
            if ($user->confirmed) {
                return AUTH_CONFIRM_ALREADY;
            } else {
                $DB->set_field("user", "confirmed", 1, array("id"=>$user->id));
                return AUTH_CONFIRM_OK;
            }
        } else  {
            return AUTH_CONFIRM_ERROR;
        }
    }
1211600
def confirms(self, txid):
        """"""
        txid = deserialize.txid(txid)
        return self.service.confirms(txid)
258137
public function authenticate()
    {
        $confirm = $this->getServiceLocator()
                        ->get( 'Grid\User\Model\ConfirmHash' );

        if ( $confirm->has( $this->hash ) )
        {
            $user = $this->getModel()
                         ->findByEmail( $confirm->find( $this->hash ) );

            if ( ! empty( $user ) )
            {
                $user->confirmed = true;

                if ( $user->save() )
                {
                    $confirm->delete( $this->hash );
                    return new Result( Result::SUCCESS, $user );
                }
                else
                {
                    return new Result( Result::FAILURE_UNCATEGORIZED, null );
                }
            }
        }
        else
        {
            return new Result( Result::FAILURE_CREDENTIAL_INVALID, null );
        }

        return new Result( Result::FAILURE_IDENTITY_NOT_FOUND, null );
    }
524168
def user_exists(username):
    """"""
    try:
        pwd.getpwnam(username)
        user_exists = True
    except KeyError:
        user_exists = False
    return user_exists
348002
function user_confirm($username, $confirmsecret) {
        global $DB;

        $user = get_complete_user_data('username', $username);

        if (!empty($user)) {
            if ($user->auth != $this->authtype) {
                return AUTH_CONFIRM_ERROR;

            } else if ($user->secret == $confirmsecret && $user->confirmed) {
                return AUTH_CONFIRM_ALREADY;

            } else if ($user->secret == $confirmsecret) {   // They have provided the secret key to get in
                if (!$this->user_activate($username)) {
                    return AUTH_CONFIRM_FAIL;
                }
                $user->confirmed = 1;
                user_update_user($user, false);
                return AUTH_CONFIRM_OK;
            }
        } else {
            return AUTH_CONFIRM_ERROR;
        }
    }
1219006
def confirmation(self, pdu):
        """"""
        if _debug: StreamToPacket._debug("StreamToPacket.confirmation %r", pdu)

        # hack it up into chunks
        for packet in self.packetize(pdu, self.upstreamBuffer):
            self.response(packet)
414363
public function confirmEmailAction()
    {
        $token = $this->params()->fromRoute('id');
        try {
            $entityManager = $this->getEntityManager();
            if($token !== '' && $user = $entityManager->getRepository('CsnUser\Entity\User')->findOneBy(array('registrationToken' => $token))) {
                $user->setRegistrationToken(md5(uniqid(mt_rand(), true)));
                $user->setState($entityManager->find('CsnUser\Entity\State', 2));
                $user->setEmailConfirmed(1);
                $entityManager->persist($user);
                $entityManager->flush();
                
                $viewModel = new ViewModel(array(
                    'navMenu' => $this->getOptions()->getNavMenu(),
                ));
                $viewModel->setTemplate('csn-user/registration/confirm-email-success');
                return $viewModel;                        
            } else {
                return $this->redirect()->toRoute('user-index', array('action' => 'login'));
            }
        } catch (\Exception $e) {
            return $this->getServiceLocator()->get('csnuser_error_view')->createErrorView(
                $this->getTranslatorHelper()->translate('Something went wrong during the activation of your account! Please, try again later.'),
                $e,
                $this->getOptions()->getDisplayExceptions(),
                $this->getOptions()->getNavMenu()
            );
        }
    }
900814
def send_registered_email(self, user, user_email, request_email_confirmation):
        """"""

        # Verify config settings
        if not self.user_manager.USER_ENABLE_EMAIL: return
        if not self.user_manager.USER_SEND_REGISTERED_EMAIL: return

        # The registered email is sent to a specific user_email.email or user.email
        email = user_email.email if user_email else user.email

        # Add a request to confirm email if needed
        if request_email_confirmation:
            # Generate a confirm_email_link
            token = self.user_manager.generate_token(user_email.id if user_email else user.id)
            confirm_email_link = url_for('user.confirm_email', token=token, _external=True)
        else:
            confirm_email_link = None

        # Render email from templates and send it via the configured EmailAdapter
        self._render_and_send_email(
            email,
            user,
            self.user_manager.USER_REGISTERED_EMAIL_TEMPLATE,
            confirm_email_link=confirm_email_link,
        )
616112
def activate_user(query):
    
    user = _query_to_user(query)
    if click.confirm(f'Are you sure you want to activate {user!r}?'):
        user.active = True
        user_manager.save(user, commit=True)
        click.echo(f'Successfully activated {user!r}')
    else:
        click.echo('Cancelled.')
248339
public function confirmSignup() : void
    {
        if (!$this->isWait()) {
            throw new \DomainException(Yii::t('setrun/user', 'User is already active'));
        }
        $this->status = self::STATUS_ACTIVE;
        $this->removeEmailConfirmToken();
    }
100577
def reset_pw_confirm_view(request, uidb64=None, token=None):
    
    return password_reset_confirm(request,
        template_name="reset_confirmation.html",
        uidb64=uidb64, token=token, post_reset_redirect=reverse('login'))
527455
def confirm(*args, **kwargs):
    """"""
    try:
        return click.confirm(*args, **kwargs)
    except click.Abort:
        return False
472018
def check_my_users(user):
    
    user_data = my_users.get(user['username'])
    if not user_data:
        return False  # <--- invalid credentials
    elif user_data.get('password') == user['password']:
        return True  # <--- user is logged in!

    return False
739833
function onConfirmPasswordReset() {
  var code = $('#password-reset-code').val();
  var password = $('#password-reset-password').val();
  auth.confirmPasswordReset(code, password).then(function() {
    alertSuccess('Password has been changed!');
  }, onAuthError);
}
22653
def generate_confirmation_token(self, user):
        
        data = [str(user.id), self.hash_data(user.email)]
        return self.security.confirm_serializer.dumps(data)
752506
def ask_confirmation():
    
    while True:
        print("Do you want to restart these brokers? ", end="")
        choice = input().lower()
        if choice in ['yes', 'y']:
            return True
        elif choice in ['no', 'n']:
            return False
        else:
            print("Please respond with 'yes' or 'no'")