Confirm an user is created in Acacha Laravel Forge.
512726
protected function confirmAnUserIsCreatedInAcachaLaravelForge()
    {
        $this->info('');
        $this->info('Please visit and login on http://forge.acacha.org');
        $this->info('');
        $this->error('Please use Github Social Login for login!!!');

        while (! $this->confirm('Do you have an user created at http:://forge.acacha.com?')) {
        }
    }
33337
public function initialize()
    {
        if ($this->checkAuthentication()) {
            $data = $this->getAuthenticationData();
            if (!isset($data['user_id'])) {
                return false;
            }

            $user = $this->toolkit->getRepository($this->userClassName)->getById($data['user_id']);
            if (!$user) {
                $this->setAuthenticated(false);
                $this->setAuthenticationData([]);
                return false;
            }
            $this->setUser($user);
            return true;
        }
        return false;
    }
1279955
public static function verify($token, $provider, $musked)
  {
    $userToken = MagicLink::where('token', $token)->first();

    if ($userToken == null) return false;
    $userEmail = $userToken->email;

    if ($userToken->created_at->diffInMinutes() <= config('auth.expire.magic_token')) {
      if (Session::has('_magic')) {
        if (Session::key('_magic') == $userToken->token) {
          $userToken->delete();
          Session::delete('_magic');
          return config("auth.provider.{$provider}.model")::where($musked, $userEmail)->first();
        }
        else {
          Session::delete('_magic');
          return false;
        }
      }
    }

    $userToken->delete();
    return false;
  }
1168647
public function createAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth(self::CONTROLLER_CHECK_RESOURCE, Dealer::getModuleCode(),
                AccessManager::CREATE)
        ) {
            return $response;
        }

        // Create the Creation Form
        $creationForm = $this->getCreationForm($this->getRequest());

        $con = Propel::getConnection();
        $con->beginTransaction();

        try {
            // Check the form against constraints violations
            $form = $this->validateForm($creationForm, "POST");
            // Get the form field values
            $data = $form->getData();

            if (empty($data["day"])) {
                $dataAM = $this->formatData($data);
                $dataPM = $this->formatData($data, 'PM');

                if ($this->hasNullDate($dataAM) && $this->hasNullDate($dataPM)) {
                    $this->getService()->createFromArray($dataAM, $this->getCurrentEditionLocale());
                } else {
                    if (!$this->hasNullDate($dataAM)) {
                        $this->getService()->createFromArray($dataAM, $this->getCurrentEditionLocale());
                    }
                    if (!$this->hasNullDate($dataPM)) {
                        $this->getService()->createFromArray($dataPM, $this->getCurrentEditionLocale());
                    }
                }
            } else {
                foreach ($data["day"] as $day) {
                    $currentData = $data;
                    $currentData["day"] = $day;
                    $dataAM = $this->formatData($currentData);
                    $dataPM = $this->formatData($currentData, 'PM');

                    if ($this->hasNullDate($dataAM) && $this->hasNullDate($dataPM)) {
                        $this->getService()->createFromArray($dataAM, $this->getCurrentEditionLocale());
                    } else {
                        if (!$this->hasNullDate($dataAM)) {
                            $this->getService()->createFromArray($dataAM, $this->getCurrentEditionLocale());
                        }
                        if (!$this->hasNullDate($dataPM)) {
                            $this->getService()->createFromArray($dataPM, $this->getCurrentEditionLocale());
                        }
                    }
                }
            }


            // Substitute _ID_ in the URL with the ID of the created object
            $successUrl = $creationForm->getSuccessUrl();

            $con->commit();

            // Redirect to the success URL
            return $this->generateRedirect($successUrl);
        } catch (FormValidationException $ex) {
            $con->rollBack();
            // Form cannot be validated
            $error_msg = $this->createStandardFormValidationErrorMessage($ex);
        } catch (\Exception $ex) {
            $con->rollBack();
            // Any other error
            $error_msg = $ex->getMessage();
        }
        if (false !== $error_msg) {
            $this->setupFormErrorContext(
                $this->getTranslator()->trans("%obj creation", ['%obj' => static::CONTROLLER_ENTITY_NAME]),
                $error_msg,
                $creationForm,
                $ex
            );

            // At this point, the form has error, and should be redisplayed.
            return $this->generateErrorRedirect($creationForm);
        }
    }
1374701
public function actionCreate()
    {
        $model = new AuthItem(null);
        $model->type = Item::TYPE_ROLE;
        if ($model->load(Yii::$app->getRequest()->post()) && $model->save()) {
            AccessHelper::refeshAuthCache();
            return $this->redirect(['view', 'id' => $model->name]);
        } else {
            return $this->render('create', ['model' => $model,]);
        }
    }
287960
public function verify(string $token, string $provider, string $musked)
  {
    $userToken = VerifiedUser::where('token', $token)->first();

    if ($userToken == null) return false;
    $userEmail = $userToken->email;

    $model = config("auth.provider.{$provider}.model")::where($musked, $userEmail)->first();

    if ($model == null) return false;

    $userToken->delete();

    $model->update([
      'email_verified_at' => Carbon::now()
    ]);

    return $model;
  }
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 );
    }
1316313
public function isCreator($field = 'created_by')
	{
		// Make sure we have a valid row
		if (!$this->hasAttribute($field))
		{
			throw new RuntimeException('Cannot determine creator of non-existant row(s)');
		}

		return $this->$field == \User::get('id');
	}
25244
def create_user(ctx):
    """"""

    try:
        new_user = _create_user(ctx)

        new_user.save()
        log("Done")
    except KeyError:
        log('User already exists', lvl=warn)
1055576
protected function validateCreatorOrder()
    {
        $field = 'creator';
        $value = $this->getSubmitted($field);

        if (!isset($value) && $this->isUpdating()) {
            $this->unsetSubmitted($field);
            return null;
        }

        if (empty($value)) {
            return null;
        }

        $label = $this->translation->text('Creator');

        if (!is_numeric($value)) {
            $this->setErrorNumeric($field, $label);
            return false;
        }

        $user = $this->user->get($value);

        if (empty($user)) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        return true;
    }
169433
public static function forge($host = null, $user = null, $password = null, $port = 21, $timeout = 90)
        {
            static::$_host = $host;
            static::$_user = $user;
            static::$_pwd = $password;
            static::$_port = (int)$port;
            static::$_timeout = (int)$timeout;

            if(!static::$instance) {
                static::$instance = new self();
            }

            return static::$instance;
        }
1194127
public function addme()
    {
        // user exists ?
        $oUser = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
        if ($oUser->load(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('uid'))) {
            $sConfirmCode = md5($oUser->oxuser__oxusername->value . $oUser->oxuser__oxpasssalt->value);
            // is confirm code ok?
            if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('confirm') == $sConfirmCode) {
                $oUser->getNewsSubscription()->setOptInStatus(1);
                $oUser->addToGroup('oxidnewsletter');
                $this->_iNewsletterStatus = 2;
            }
        }
    }
1295668
private function createUser()
    {
        $this->climate()->underline()->out(
            $this->translator()->translate('Create a new Charcoal Administrator User')
        );

        $user       = $this->modelFactory()->create(User::class);
        $prompts    = $this->userPrompts();
        $properties = $user->properties(array_keys($prompts));

        $vals = [];
        foreach ($properties as $prop) {
            if (!in_array($prop->ident(), array_keys($prompts))) {
                continue;
            }

            $prompt = $prompts[$prop->ident()];

            if ($prompt['property']) {
                $v = $prompt['property'];
            } else {
                $v = $this->promptProperty($prop, $prompt['label']);
            }
            if (isset($prompt['validation'])) {
                call_user_func($prompt['validation'], $v);
            }

            $prop->setVal($v);
            $vals[$prop->ident()] = $v;
        }

        // Trigger reset password
        $user->resetPassword($vals['password']);
        unset($vals['password']);

        $user->setFlatData($vals);
        $ret = $user->save();

        if ($ret) {
            $this->climate()->green()->out("\n".sprintf('Success! User "%s" created.', $user->email()));
        } else {
            $this->climate()->red()->out("\nError. User could not be created.");
        }
    }
100103
def is_owner(self, user):
        
        if user.is_authenticated:
            return self.created_by.id == user.id
        return False
406455
public function create($user)
    {
        $user = User::findOrFail($user->id);

        return $user->hasPermission('laralum::users.create') || $user->superAdmin();
    }
1370728
public function onRegister()
    {
        try {
            if (!$this->canRegister()) {
                throw new ApplicationException(Lang::get(/*Registrations are currently disabled.*/'rainlab.user::lang.account.registration_disabled'));
            }

            /*
             * Validate input
             */
            $data = post();

            if (!array_key_exists('password_confirmation', $data)) {
                $data['password_confirmation'] = post('password');
            }

            $rules = [
                'email'    => 'required|email|between:6,255',
                'password' => 'required|between:4,255|confirmed'
            ];

            if ($this->loginAttribute() == UserSettings::LOGIN_USERNAME) {
                $rules['username'] = 'required|between:2,255';
            }

            $validation = Validator::make($data, $rules);
            if ($validation->fails()) {
                throw new ValidationException($validation);
            }

            /*
             * Register user
             */
            Event::fire('rainlab.user.beforeRegister', [&$data]);

            $requireActivation = UserSettings::get('require_activation', true);
            $automaticActivation = UserSettings::get('activate_mode') == UserSettings::ACTIVATE_AUTO;
            $userActivation = UserSettings::get('activate_mode') == UserSettings::ACTIVATE_USER;
            $user = Auth::register($data, $automaticActivation);

            Event::fire('rainlab.user.register', [$user, $data]);

            /*
             * Activation is by the user, send the email
             */
            if ($userActivation) {
                $this->sendActivationEmail($user);

                Flash::success(Lang::get(/*An activation email has been sent to your email address.*/'rainlab.user::lang.account.activation_email_sent'));
            }

            /*
             * Automatically activated or not required, log the user in
             */
            if ($automaticActivation || !$requireActivation) {
                Auth::login($user);
            }

            /*
             * Redirect to the intended page after successful sign in
             */
            if ($redirect = $this->makeRedirection(true)) {
                return $redirect;
            }
        }
        catch (Exception $ex) {
            if (Request::ajax()) throw $ex;
            else Flash::error($ex->getMessage());
        }
    }
113212
public function actionCreate()
    {
        $model = new UserAuthItem(null);
        $model->type = $this->type;
        if ($model->load(Yii::$app->getRequest()->post()) && $model->save()) {
            Yii::$app->getSession()->setFlash('success', Yii::t('yuncms','Create success.'));
            return $this->redirect(['view', 'id' => $model->name]);
        } else {
            return $this->render('create', ['model' => $model]);
        }
    }