-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added button to create account using an account creation token
- Loading branch information
1 parent
dd6c844
commit 0f229da
Showing
5 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
exports = module.exports = function(req, res) { | ||
|
||
var locals = res.locals; | ||
|
||
// locals.section is used to set the currently selected | ||
// item in the header navigation. | ||
locals.section = 'account'; | ||
|
||
if (req.body.token){ | ||
locals.tokenURL = process.env.API_URL+"/users/activate?token="+ req.body.token | ||
} | ||
else{ | ||
let flash = {}; | ||
flash.type = 'Error!'; | ||
flash.class = 'alert-danger'; | ||
flash.messages = [{msg: 'Invalid or missing account token'}]; | ||
|
||
let buff = Buffer.from(JSON.stringify(flash)); | ||
let data = buff.toString('base64'); | ||
|
||
return res.redirect('/?flash='+data); | ||
} | ||
|
||
// Render the view | ||
res.render('account/create'); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
extends ../../layouts/default | ||
include ../../mixins/flash-messages | ||
include ../../mixins/form/account | ||
|
||
block content | ||
.container.text-center | ||
.row | ||
.col-md-12 | ||
h1.account-title Create account | ||
h4.account-subtitle.text-center Click the button below to confirm the account creation | ||
hr | ||
.row | ||
.col-md-offset-3.col-md-6 | ||
+flash-messages(flash) | ||
|
||
.row | ||
.col-md-offset-3.col-md-6 | ||
a(href=tokenURL) | ||
button.btn.btn-default.btn-lg.btn-outro.btn-danger Create account | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters