Skip to content

Commit

Permalink
[skip ci][auth] fix _newAccountCreationRule name
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheron committed Feb 14, 2022
1 parent 837f296 commit 64815a6
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 6 deletions.
Binary file added docs/_static/images/auth/2fa-code.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/images/auth/account-creation.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions docs/scaffolding/auth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@ Multi-factor authentication can be enabled conditionally, based on the pre-logge
}
.. image:: /_static/images/auth/2fa-code.png


.. note::
It is possible to customize the creation of the generated code, as well as the prefix used.

Expand All @@ -372,6 +375,8 @@ Account creation

The activation of the account creation is also optional:

.. image:: /_static/images/auth/account-creation-available.png

.. code-block:: php
:linenos:
:caption: app/controllers/PersoAuthController.php
Expand All @@ -385,6 +390,8 @@ The activation of the account creation is also optional:
}
.. image:: /_static/images/auth/account-creation.png

In this case, the _create method must be overridden in order to create the account:

.. code-block:: php
Expand All @@ -410,6 +417,8 @@ You can check the validity/availability of the login before validating the accou
}
.. image:: /_static/images/auth/account-creation-error.png

A confirmation action (email verification) may be requested from the user:

.. code-block:: php
Expand Down
4 changes: 2 additions & 2 deletions src/Ubiquity/controllers/auth/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public function addAccount(){
$frm=$this->_addFrmAjaxBehavior('frm-create');
$passwordInputName=$this->_getPasswordInputName();
$frm->addExtraFieldRules($passwordInputName.'-conf', ['empty',"match[$passwordInputName]"]);
if($this->newAccountCreationRule('')!==null){
$this->jquery->exec(Rule::ajax($this->jquery, 'checkAccount', $this->getBaseUrl () . '/_newAccountCreationRule', '{}', 'result=data.result;', 'postForm', [
if($this->_newAccountCreationRule('')!==null){
$this->jquery->exec(Rule::ajax($this->jquery, 'checkAccount', $this->getBaseUrl () . '/newAccountCreationRule', '{}', 'result=data.result;', 'postForm', [
'form' => 'frm-create'
]), true);
$frm->addExtraFieldRule($this->_getLoginInputName(), 'checkAccount','Account {value} is not available!');
Expand Down
6 changes: 3 additions & 3 deletions src/Ubiquity/controllers/auth/AuthControllerCoreTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ abstract public function _getBodySelector();

abstract public function _getBaseRoute();

abstract protected function newAccountCreationRule(string $accountName):?bool;
abstract protected function _newAccountCreationRule(string $accountName):?bool;

abstract public function _getLoginInputName();

Expand All @@ -50,11 +50,11 @@ protected function fMessage(FlashMessage $fMessage, $id = null):string {
return $this->message ( $fMessage->getType (), $fMessage->getTitle (), $fMessage->getContent (), $fMessage->getIcon (), $id );
}

public function _newAccountCreationRule(){
public function newAccountCreationRule(){
if (URequest::isPost()) {
$result = [];
UResponse::asJSON();
$result['result'] = $this->newAccountCreationRule(URequest::post($this->_getLoginInputName()));
$result['result'] = $this->_newAccountCreationRule(URequest::post($this->_getLoginInputName()));
echo \json_encode($result);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected function _send2FACode(string $code,$connected):void{
* @param string $accountName
* @return bool
*/
protected function newAccountCreationRule(string $accountName):?bool{
protected function _newAccountCreationRule(string $accountName):?bool{

}

Expand Down

0 comments on commit 64815a6

Please sign in to comment.