Confirms user's account. If confirmation was successful logs the user and shows success message. Otherwise
shows error message.

@param integer $id
@param string $code

@return string
488087
public function actionConfirm($id, $code)
    {
        $user = User::findOne($id);
        if ($user === null || Yii::$app->settings->get('enableConfirmation','user') == false) {
            return $this->goBack();
        }
        $user->attemptEmailConfirmation($code);
        return $this->redirect(['/user/settings/profile']);
    }
660212
public function getIdByCode($alias, $code, $id_only = true, array $options = []) {
		$class = $this->data[$alias]['no_data_alias_model'];
		$model = new $class();
		$columns = [];
		if ($id_only) {
			$columns[] = $model->column_prefix . 'id';
		}
		$data = $model->get([
			'columns' => $columns,
			'where' => [
				$this->data[$alias]['no_data_alias_column'] => $code . ''
			],
			'pk' => null,
			'skip_acl' => $options['skip_acl'] ?? false,
			'no_cache' => true,
		]);
		// if we have results we need to make it single row
		if (isset($data[0])) {
			$data = $data[0];
		}
		if (!$id_only) {
			return $data;
		} else {
			return $data[$model->column_prefix . 'id'] ?? null;
		}
	}
1078676
public function getInfo(string $id, string $code): array
    {
        return $this->httpClient->postJson('card/invoice/reimburse/getinvoiceinfo', ['card_id' => $id, 'encrypt_code' => $code]);
    }
1163322
public function getAuthorizationCode($code)
	{
		// auth model
		$authorizationCode = \Components\Developer\Models\Authorizationcode::oneByCode($code);

		// fetch by code
		if (!$authorizationCode->get('id'))
		{
			return false;
		}

		// get the application's client id
		$application = \Components\Developer\Models\Application::oneOrFail($authorizationCode->get('application_id'));
		$authorizationCode->set('client_id', $application->get('client_id'));

		// format expires to unix timestamp for authorization code grant type
		$authorizationCode->set('expires', with(new Date($authorizationCode->get('expires')))->toUnix());

		// return code
		return $authorizationCode->toArray();
	}
563481
public function getAuthorizationCode($code)
    {
        $result = $this->client->getItem(array(
            "TableName"=> $this->config['code_table'],
            "Key" => array('authorization_code'   => array('S' => $code))
        ));
        if ($result->count()==0) {
            return false ;
        }
        $token = $this->dynamo2array($result);
        if (!array_key_exists("id_token", $token )) {
            $token['id_token'] = null;
        }
        $token['expires'] = strtotime($token['expires']);

        return $token;

    }
712736
protected function _getNewsSubsLink($id, $confirmCode = null)
    {
        $myConfig = Registry::getConfig();
        $actShopLang = $myConfig->getActiveShop()->getLanguage();

        $url = $myConfig->getShopHomeUrl() . 'cl=newsletter&amp;fnc=addme&amp;uid=' . $id;
        $url .= '&amp;lang=' . $actShopLang;
        $url .= ($confirmCode) ? '&amp;confirm=' . $confirmCode : "";

        return $url;
    }
138746
public function incrementNextRecordCode($code = null)
    {
        if (is_null($code)) {
            $code = $this->getMyKey();
        }

        if (is_string($code)) {
            $sro  = $this->performRequest($this->evidence.'/(kod=\''.$code.'\').json');
            $crID = current(current($sro[$this->evidence]));
        } else {
            $crID = $code;
        }

        $cr                = $this->performRequest($this->evidence.'/'.$crID.'.json');
        $radaPokladniPohyb = current($cr[$this->evidence]);
        $crInfo            = end($radaPokladniPohyb['polozkyRady']);

        $cislo = $crInfo['cisAkt'] + 1;
        return $cislo;
    }
361634
public static function confirm($id, $options = null)
    {
        $url = static::classUrl().'/'.$id;
        $params = array('status' => 'pending');
        return static::_directRequest('put', $url, $params, $options);
    }
1033245
public function confirmByCode($code)
    {
        $identity = ['confirmation_code' => $code];

        $account = $this->findByIdentity($identity);

        if($account){

            return $this->confirm($account);
        } else{

            return false;
        }
    }
565829
private function response($code)
    {
        switch ($code) {
            // Successful
            case 200:
            case 304:
                return $this->success();
            // Non existent user
            case 403: // Forbidden:
                return $this->forbidden();
            case 404: // Removed
                return $this->requestDoesNotExist();
            // Rate limit
            case 429:
                return $this->rateLimit();
            // OAuth Credentials are NOT VALID or others
            case 400:
            default:
                return $this->generalError();
        }
    }
978606
public function update($id)
    {
        $success = false;
        $message = '';
        $user    = null;
        $code    = 0;

        try{
            $input = Input::put();
            /** in case request come from post http form */
            $input = is_null($input) ? Input::post() : $input;

            if($input['password'] != $input['confirm_password']){
                throw new Exception("Password and confirmation password not match", 1);
            }

            $user = Sentry::findUserById($id);

            $user->email        = $input['email'];
            $user->first_name   = $input['first_name'];
            $user->last_name    = $input['last_name'];

            if($input['password']){
                $user->password = $input['password'];
            }

            $success = $user->save();
            $code    = 200;
            $message = 'User updated sucessully';
        }catch(UserNotFoundException $e){
            $message = $e->getMessage();
            $code    = 404;
        }catch (Exception $e){
            $message = $e->getMessage();
            $code    = 500;
        }

        if(Request::isAjax()){
            Response::headers()->set('Content-Type', 'application/json');
            Response::setBody(json_encode(
                array(
                    'success'   => $success,
                    'data'      => ($user) ? $user->toArray() : $user,
                    'message'   => $message,
                    'code'      => $code
                )
            ));
        }else{
            Response::redirect($this->siteUrl('admin/user/'.$id.'/edit'));
        }
    }
888217
protected function isSuccess($response, $code)
    {
        if (in_array(Arr::get($response, 'status'), $this->successPaymentStatuses)) {
            return true;
        }

        // Account::info() case
        if (isset($response['site_id'])) {
            return true;
        }

        $success = false;

        // Checking refund, docs say 200 but 201 is currently returned
        // https://www.mercadopago.com.mx/developers/en/solutions/payments/basic-checkout/refund-cancel/
        if ($code === 200 || $code === 201) {
            $success = isset($response['id'])
                && isset($response['payment_id'])
                && isset($response['amount'])
                && isset($response['metadata'])
                && isset($response['source']);
        }

        return $success;
    }
1011831
public function getMembercardUserInfo($code, $card_id)
    {
        $params = array();
        $params['code'] = $code;
        $params['card_id'] = $card_id;
        $rst = $this->_request->post($this->_url . 'card/membercard/userinfo/get', $params);
        return $this->_client->rst($rst);
    }
124317
public function getForgotPasswordConfirm($userId, $passwordResetCode)
    {
        // Find the user using the password reset code
        if(!$user = Sentinel::findById($userId))
        {
            // Redirect to the forgot password page
            return Redirect::route('forgot-password')->with('error', Lang::get('base.auth.forgot_password_confirm.error'));
        }

        // Show the page
        return View('auth.forgot-password-confirm', compact('userId', 'passwordResetCode'));
    }
538655
public function verifyMethod($uid, $employee_id, $code)
    {
        $result = $this->verifyMethodInternal(compact('uid', 'employee_id', 'code'));
        $statusCode = (int)$result[ 'statusCode' ];

        if ($statusCode === 200) {
            return $this->getResultAsArrayWithoutStatusCode($result);
        }

        $this->reportUnexpectedResponse($result, 1541006448);
    }
470040
public function actionConfirm($id, $code, $return)
    {
        $user = $this->finder->findUserById($id);

        if ($user === null || $this->module->enableConfirmation == false) {
            throw new NotFoundHttpException();
        }

        $event = $this->getUserEvent($user);

        $this->trigger(self::EVENT_BEFORE_CONFIRM, $event);

        $user->attemptConfirmation($code);

        $this->trigger(self::EVENT_AFTER_CONFIRM, new UserRegistrationEvent([
            'id' => $user->id
        ]));

        if (!empty($return)) {
            \Yii::$app->user->setReturnUrl($return);
            return $this->redirect($return);
        }

        return $this->render('/message', [
            'title'  => \Yii::t('user', 'Account confirmation'),
            'module' => $this->module,
        ]);
    }
610169
public function actionConfirm($id, $code)
    {
        $user = User::findOne($id);
        if ($user === null || $this->emailChangeStrategy == Settings::STRATEGY_INSECURE) {
            throw new NotFoundHttpException();
        }
        $user->attemptEmailChange($code);
        return $this->redirect(['account']);
    }