public function validateemailAction() {
        $this->view->title = __('activate email page title');
        $auth = Garp_Auth::getInstance();
        $authVars = $auth->getConfigValues();
        $request = $this->getRequest();
        $activationCode = $request->getParam('c');
        $activationEmail = $request->getParam('e');
        $emailValidColumn = $authVars['validateemail']['email_valid_column'];

        if (!$activationEmail || !$activationCode) {
            throw new Zend_Controller_Action_Exception('Invalid request.', 404);
        }

        $userModel = new Model_User();
        // always collect fresh data for this one
        $userModel->setCacheQueries(false);
        $activationCodeClause = 'MD5(CONCAT(' .
                $userModel->getAdapter()->quoteIdentifier(
                    $authVars['validateemail']['token_column']
                ) . ',' .
                'MD5(email),' .
                'MD5(' . $userModel->getAdapter()->quote($authVars['salt']) . '),' .
                'MD5(id)' .
            ')) = ?'
        ;
        $select = $userModel->select()
            // check if a user matches up to the given code
            ->where($activationCodeClause, $activationCode)
            // check if the given email address is part of the same user record
            ->where('MD5(email) = ?', $activationEmail);

        $user = $userModel->fetchRow($select);
        if (!$user) {
            $this->view->error = __('invalid email activation code');
        } else {
            $user->{$emailValidColumn} = 1;
            if (!$user->save()) {
                $this->view->error = __('activate email error');
            } elseif ($auth->isLoggedIn()) {
                // If the user is currently logged in, update the cookie
                $method = $auth->getStore()->method;
                $userData = $auth->getUserData();
                // Sanity check: is the user that has just validated his email address
                // the currently logged in user?
                if ($userData['id'] == $user->id) {
                    $userData[$emailValidColumn] = 1;
                    $auth->store($userData, $method);
                }
            }
            $this->view->user = $user;
        }
    }