Authorization and registration on the one page
-
- I had a problem when creating a authorization and registration on the one page:
https://github.com/NodeBB/NodeBB/blob/master/src/routes/authentication.js#L65
router.post('/register', Auth.middleware.applyCSRF, Auth.middleware.applyBlacklist, controllers.authentication.register);
router.post('/login', Auth.middleware.applyCSRF, Auth.middleware.applyBlacklist, controllers.authentication.login);
router.post('/logout', Auth.middleware.applyCSRF, controllers.authentication.logout);
How specify a one url for
controllers.authentication.register
andcontrollers.authentication.login
?
- The second problem was with the attribute username and password:
https://github.com/NodeBB/nodebb-theme-persona/blob/master/templates/register.tpl#L27
<input class="form-control" type="text" placeholder="[[register:username_placeholder]]"
name="username"
id="username" autocorrect="off" autocapitalize="off" autocomplete="off" />https://github.com/NodeBB/nodebb-theme-persona/blob/master/templates/register.tpl#L39
<input class="form-control" type="password" placeholder="[[register:password_placeholder]]"
name="password"
id="password" />...same attributes at login
https://github.com/NodeBB/nodebb-theme-persona/blob/master/templates/login.tpl#L17
<input class="form-control" type="text" placeholder="{allowLoginWith}" name="username"
id="username"
autocorrect="off" autocapitalize="off" />https://github.com/NodeBB/nodebb-theme-persona/blob/master/templates/login.tpl#L23
<input class="form-control" type="password" placeholder="[[user:password]]"
name="password"
id="password" />I tried to rename the registration attributes on
name="newusername"
andname="newpassword"
so that they do not conflict with each other, but registration has stopped working.
If this is not done, then the registration will be available through the authorization form.