Register User - It register the user and set status to new. It also generate verification token.

@param RegisterForm $model
@return User
435138
public function register( $model, $config = [] ) {

		$status	= isset( $config[ 'status' ] ) ? $config[ 'status' ] : User::STATUS_NEW;
		$user	= isset( $config[ 'user' ] ) ? $config[ 'user' ] : $this->getModelObject();

		$date	= DateUtil::getDateTime();

		$user->email		= $model->email;
		$user->username		= $model->username;
		$user->title		= $model->title;
		$user->firstName	= $model->firstName;
		$user->middleName	= $model->middleName;
		$user->lastName		= $model->lastName;
		$user->mobile		= $model->mobile;
		$user->dob			= $model->dob;
		$user->registeredAt	= $date;
		$user->status		= $status;
		$user->type			= $model->type;

		$user->generatePassword( $model->password );
		$user->generateVerifyToken();
		$user->generateAuthKey();
		$user->generateOtp();

		$user->save();

		return $user;
	}
238400
public function postRegister()
    {
        if( $this->userForm->register(Input::all(),false) )
        {
            return Redirect::route('cpanel.login')
                ->with('success', Lang::get('cpanel::users.register_success'));
        }

        return Redirect::back()
            ->withInput()
            ->withErrors($this->userForm->getErrors());

    }
599119
public function register(Request $request)
    {
        $this->validator($request->all())->validate();

        event(new Registered($user = $this->create($request->all())));

        // Set first user to admin
        if ($user->id === 1) {

            $user->activated = true;
            $user->save();

            $user
                ->roles()
                ->attach(Role::where('name', 'admin')->first());

            $this->guard()->login($user);

            flash('Welcome, you have successfully registered and is now ready to take on the world.')->success();

            return $this->registered($request, $user)
                ?: redirect($this->redirectPath());

        } else {
            $user
                ->roles()
                ->attach(Role::where('name', 'employee')->first());

            flash('You have been registered, but an administrator must approve your account. Don´t worry tho, we have already sent a notification that you are waiting.')->info();

            return $this->registered($request, $user)
                ?: redirect()->route('auth.login');
        }


    }
1274234
public function registerAction()
    {
        $userIdentityField = $this->container->getParameter('rch_jwt_user.user_identity_field');
        $userManager = $this->container->get('fos_user.user_manager');
        $userClass = $userManager->getClass();

        $rules = [
            $userIdentityField => [
                'requirements' => ['email' == $userIdentityField ? new Email() : '[^/]+'],
            ],
            'password' => ['requirements' => '[^/]+'],
        ];

        $params = $this->get('rch_jwt_user.credential_fetcher')
            ->create($rules)
            ->all();

        $user = $this->createUser($params, $userManager);

        return $this->renderToken($user, 201);
    }
693902
public function RegisterForm()
    {

        // If back URL set, push to session
        if (isset($_REQUEST['BackURL'])) {
            Session::set('BackURL', $_REQUEST['BackURL']);
        }

        $config = Users::config();

        // Setup form fields
        $fields = FieldList::create(
            TextField::create("FirstName"),
            TextField::create("Surname"),
            EmailField::create("Email"),
            $password_field = ConfirmedPasswordField::create("Password")
        );

        $password_field->minLength = $config->get("password_min_length");
        $password_field->maxLength = $config->get("password_max_length");
        $password_field->requireStrongPassword = $config->get("password_require_strong");

        // Setup form actions
        $actions = new FieldList(
            FormAction::create("doRegister", "Register")
                ->addExtraClass("btn")
                ->addExtraClass("btn-green")
        );

        // Setup required fields
        $required = new RequiredFields(
            array(
            "FirstName",
            "Surname",
            "Email",
            "Password"
            )
        );

        $form = Form::create(
            $this,
            "RegisterForm",
            $fields,
            $actions,
            $required
        )->addExtraClass("forms")
        ->addExtraClass("forms-columnar");

        $this->extend("updateRegisterForm", $form);

        $session_data = Session::get("Form.{$form->FormName()}.data");

        if ($session_data && is_array($session_data)) {
            $form->loadDataFrom($session_data);
            Session::clear("Form.{$form->FormName()}.data");
        }

        return $form;
    }
1297254
private function RegisterApproval() {
      Gdn::UserModel()->AddPasswordStrength($this);
      
      // If the form has been posted back...
      if ($this->Form->IsPostBack()) {
         
         // Add validation rules that are not enforced by the model
         $this->UserModel->DefineSchema();
         $this->UserModel->Validation->ApplyRule('Name', 'Username', $this->UsernameError);
         $this->UserModel->Validation->ApplyRule('TermsOfService', 'Required', T('You must agree to the terms of service.'));
         $this->UserModel->Validation->ApplyRule('Password', 'Required');
         $this->UserModel->Validation->ApplyRule('Password', 'Strength');
         $this->UserModel->Validation->ApplyRule('Password', 'Match');
         $this->UserModel->Validation->ApplyRule('DiscoveryText', 'Required', 'Tell us why you want to join!');
         // $this->UserModel->Validation->ApplyRule('DateOfBirth', 'MinimumAge');
         
         $this->FireEvent('RegisterValidation');
         
         try {
            $Values = $this->Form->FormValues();
            unset($Values['Roles']);
            $AuthUserID = $this->UserModel->Register($Values);
            if (!$AuthUserID) {
               $this->Form->SetValidationResults($this->UserModel->ValidationResults());
            } else {
               // The user has been created successfully, so sign in now.
               Gdn::Session()->Start($AuthUserID);

               if ($this->Form->GetFormValue('RememberMe'))
                  Gdn::Authenticator()->SetIdentity($AuthUserID, TRUE);
               
               // Notification text
               $Label = T('NewApplicantEmail', 'New applicant:');
               $Story = Anchor(Gdn_Format::Text($Label.' '.$Values['Name']), ExternalUrl('dashboard/user/applicants'));

               $this->EventArguments['AuthUserID'] = $AuthUserID;
               $this->EventArguments['Story'] = &$Story;
               $this->FireEvent('RegistrationPending');
               $this->View = "RegisterThanks"; // Tell the user their application will be reviewed by an administrator.
               
               // Grab all of the users that need to be notified.
               $Data = Gdn::Database()->SQL()->GetWhere('UserMeta', array('Name' => 'Preferences.Email.Applicant'))->ResultArray();
               $ActivityModel = new ActivityModel();
               foreach ($Data as $Row) {
                  $ActivityModel->Add($AuthUserID, 'Applicant', $Story, $Row['UserID'], '', '/dashboard/user/applicants', 'Only');
               }
            }
         } catch (Exception $Ex) {
            $this->Form->AddError($Ex);
         }
      }
      $this->Render();
   }
959871
public function actionRegister()
    {
        if (!Yii::$app->user->isGuest) {
            Yii::$app->session->setFlash('danger', Yii::t('user', 'You have already registered.'));
            return $this->goBack();
        }
        if (!$this->getSetting('enableRegistration')) {
            Yii::$app->session->setFlash('danger', Yii::t('user', 'The system has closed the new user registration.'));
            return $this->goBack();
        }
        /** @var RegistrationForm $model */
        $model = new RegistrationForm();

        if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
            Yii::$app->response->format = Response::FORMAT_JSON;
            return ActiveForm::validate($model);
        }
        if ($model->load(Yii::$app->request->post()) && $model->register()) {
            return $this->redirect(['/user/settings/profile']);
        }
        return $this->render('register', [
            'model' => $model,
            'enableRegistrationCaptcha' => $this->getSetting('enableRegistrationCaptcha'),
            'enableGeneratingPassword'=>$this->getSetting('enableGeneratingPassword'),
        ]);
    }
787769
public function registerUser()
    {
        // Create the new user
        $user = $this->user->create($this->getUserFromRequest());

        if (! $user) {
            return $user;
        }

        // Fire the registering event.
        event(new UserRegistering($user));

        // Add the extra details needed to finish them.
        // Add the user details.
        $this->userDetails->create($this->getUserDetailsFromRequest($user));

        // Assign the user to the default group
        $user->assignRole(config('jumpgate.users.default_role'));

        // If we do not require activation, set the user as active.
        if (! config('jumpgate.users.require_email_activation')) {
            $user->setStatus(Status::ACTIVE);
        }

        // Fire the registered event.
        event(new UserRegistered($user));

        return $user;
    }
498509
public function register()
    {
        $this->mergeConfigFrom(
            __DIR__ . '/../config/config.php', 'translatable-bootforms'
        );

        // Override BootForm's form builder in order to get model binding
        // between BootForm & TranslatableBootForm working.
        $this->app->singleton('adamwathan.form', function ($app) {
            $formBuilder = new Form\FormBuilder();
            $formBuilder->setLocales($this->getLocales());
            $formBuilder->setErrorStore($app['adamwathan.form.errorstore']);
            $formBuilder->setOldInputProvider($app['adamwathan.form.oldinput']);

            $token = version_compare(Application::VERSION, '5.4', '<')
                ? $app['session.store']->getToken()
                : $app['session.store']->token();

            $formBuilder->setToken($token);

            return $formBuilder;
        });

        // Define TranslatableBootForm.
        $this->app->singleton('translatable-bootform', function ($app) {
            $form = new TranslatableBootForm($app['bootform']);
            $form->locales($this->getLocales());

            return $form;
        });
    }
1147539
public function registerToken(\Globalis\PuppetSkilled\Database\Magic\Model $user)
    {
        $this->queryBuilder->from($this->getTokenTable())
            ->insert([
                'user_id' => $user->getKey(),
                'token' => ($token = $this->generateResetToken()),
                'created_at' => new Carbon(),
            ]);
        return $token;
    }
656882
public function register(Request $request)
    {
        // Preventing spamer registration
        if ($request->input('account_intent')) {
            return redirect()->route('home');
        }

        $this->validator->setData($request->all());
        $input = $this->validator->validate('register');
        $user  = dispatch_now(new CreateUser($input));
        event(new Registered($user));

        $this->guard()->login($user);

        dispatch(new SendWelcomeEmail($user));
        session()->put('showWelcomePage', true);

        return redirect(routeMl('account.welcome', $this->getEffectiveLocale()));
    }
308487
public function handle(RegistrationRequest $request)
    {
        DB::beginTransaction();

        // Try to register the user.
        try {
            $user = $this->registration->registerUser();
        } catch (\Exception $exception) {
            DB::rollBack();

            logger()->error($exception);

            return redirect(route('auth.register'))
                ->with('errors', $exception->getMessage());
        }

        DB::commit();

        // If the app requires activation, generate a token and email them.
        if (config('jumpgate.users.require_email_activation')) {
            return redirect(route('auth.activation.generate', $user->id));
        }

        // Log the user in.
        auth()->login($user);

        return redirect(route('home'))
            ->with('message', 'Your account has been created.');
    }
282794
public function register(Request $request, Users $users)
    {
        // if registration is closed, deny access
        if (!config('back-project.registration_open')) {
            abort(403, trans('back-project::base.registration_closed'));
        }
        $this->validator($request->all())->validate();
        //$this->guard()->login($this->create($request->all()));
        $user = $users->create($request->all());

        event(new Registered($user->id));

        if ($users->getModel()->count() == 1) {
            $user->assignRole('administrator');
        } else {
            $user->assignRole('user');
        }

        Alert::add('success', trans('back-project::base.registration_email'))->flash();

        return redirect(route('login'));
    }
1258040
public function registerAction(Request $request)
    {
        /** @var UserManager $userManager */
        $userManager = $this->get('sik_industries.user_manager');
        $user = $userManager->createUser();
        $form = $this->createForm(new UserRegistrationForm(), $user);
        $form->submit($request);

        if ($form->isValid()) {
            /** @var EQM $eqm */
            $userManager->insert($user);

            $response = $this->redirect($this->generateUrl('dashboard'));
        } else {
            $response = ['form' => $form->createView()];
        }

        return $response;
    }
778759
protected function registerModel()
    {
        $this->app['generate.model'] = $this->app->share(function($app)
        {
            $generator = $this->app->make('Way\Generators\Generator');

            return new ModelGeneratorCommand($generator);
        });

        $this->commands('generate.model');
    }
718394
public function register(Request $request)
    {
        $attributes = request()->validate(User::$rules);

        // create new user
        $user = User::create([
            'firstname'          => $attributes['firstname'],
            'lastname'           => $attributes['lastname'],
            'email'              => $attributes['email'],
            'password'           => bcrypt($attributes['password']),
            'confirmation_token' => 'confirmation_token', // will generate a new unique token
        ]);

        // add user roles
        // send email
        // log activity
        event(new UserRegistered($user, input('token')));

        alert()->success('Thank you,',
            'your account has been created, please check your inbox for further instructions.');

        log_activity('Register', $user->fullname . ' registered.');

        return redirect(route('login'));
    }
87833
public function creating(Model $model)
    {
        $model->created_at = time();
        $model->created_by = $this->guard->check() ? $this->guard->user()->getId() : null;
    }