mirror of
https://github.com/wassname/talk.git
synced 2026-08-17 11:27:52 +08:00
use referer from headers
This commit is contained in:
@@ -118,12 +118,8 @@ const SendEmailConfirmation = (app, userID, email, referer) => UsersService
|
||||
|
||||
// create a local user.
|
||||
router.post('/', (req, res, next) => {
|
||||
const {
|
||||
email,
|
||||
password,
|
||||
redirectUri,
|
||||
displayName
|
||||
} = req.body;
|
||||
const {email, password, displayName} = req.body;
|
||||
const redirectUri = req.header('Referer');
|
||||
|
||||
UsersService
|
||||
.createLocalUser(email, password, displayName)
|
||||
@@ -184,6 +180,7 @@ router.post('/:user_id/actions', authorization.needed(), (req, res, next) => {
|
||||
// trigger an email confirmation re-send by a new user
|
||||
router.post('/resend-confirm', (req, res, next) => {
|
||||
const {email} = req.body;
|
||||
const redirectUri = req.header('Referer');
|
||||
|
||||
if (!email) {
|
||||
return next(errors.ErrMissingEmail);
|
||||
@@ -192,7 +189,7 @@ router.post('/resend-confirm', (req, res, next) => {
|
||||
// find user by email.
|
||||
// if the local profile is verified, return an error code?
|
||||
// send a 204 after the email is re-sent
|
||||
SendEmailConfirmation(req.app, null, email, process.env.TALK_ROOT_URL)
|
||||
SendEmailConfirmation(req.app, null, email, redirectUri)
|
||||
.then(() => {
|
||||
res.status(204).end();
|
||||
})
|
||||
|
||||
+1
-1
@@ -538,7 +538,7 @@ module.exports = class UsersService {
|
||||
* @param {String} email The email that we are needing to get confirmed.
|
||||
* @return {Promise}
|
||||
*/
|
||||
static createEmailConfirmToken(userID = null, email, referer) {
|
||||
static createEmailConfirmToken(userID = null, email, referer = process.env.TALK_ROOT_URL) {
|
||||
if (!email || typeof email !== 'string') {
|
||||
return Promise.reject('email is required when creating a JWT for resetting passord');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user