Change username to email in JWT

This commit is contained in:
Matthew Dillon 2015-04-10 11:15:32 -08:00
parent ea43effec8
commit 3f0b074619
3 changed files with 7 additions and 7 deletions

View file

@ -9,7 +9,7 @@
{{else}} {{else}}
<form {{action "authenticate" on="submit"}}> <form {{action "authenticate" on="submit"}}>
<h2>Log In</h2> <h2>Log In</h2>
{{input value=identification type="text" placeholder="Username"}} {{input value=identification type="text" placeholder="Email"}}
{{input value=password type="password" placeholder="Password"}} {{input value=password type="password" placeholder="Password"}}
{{input class="button-gray" type="submit" value="Log In"}} {{input class="button-gray" type="submit" value="Log In"}}
</form> </form>

View file

@ -31,7 +31,7 @@ module.exports = function(environment) {
} }
ENV['simple-auth-token'] = { ENV['simple-auth-token'] = {
serverTokenEndpoint: '/api/authenticate', serverTokenEndpoint: '/api/authenticate',
identificationField: 'username', identificationField: 'email',
passwordField: 'password', passwordField: 'password',
tokenPropertyName: 'token', tokenPropertyName: 'token',
authorizationPrefix: 'Bearer ', authorizationPrefix: 'Bearer ',
@ -61,7 +61,7 @@ module.exports = function(environment) {
} }
ENV['simple-auth-token'] = { ENV['simple-auth-token'] = {
serverTokenEndpoint: 'https://bactdb-test.herokuapp.com/api/authenticate', serverTokenEndpoint: 'https://bactdb-test.herokuapp.com/api/authenticate',
identificationField: 'username', identificationField: 'email',
passwordField: 'password', passwordField: 'password',
tokenPropertyName: 'token', tokenPropertyName: 'token',
authorizationPrefix: 'Bearer ', authorizationPrefix: 'Bearer ',
@ -95,7 +95,7 @@ module.exports = function(environment) {
} }
ENV['simple-auth-token'] = { ENV['simple-auth-token'] = {
serverTokenEndpoint: 'https://bactdb.herokuapp.com/api/authenticate', serverTokenEndpoint: 'https://bactdb.herokuapp.com/api/authenticate',
identificationField: 'username', identificationField: 'email',
passwordField: 'password', passwordField: 'password',
tokenPropertyName: 'token', tokenPropertyName: 'token',
authorizationPrefix: 'Bearer ', authorizationPrefix: 'Bearer ',

View file

@ -8,15 +8,15 @@ module.exports = function(app) {
var ms = 3000 + new Date().getTime(); var ms = 3000 + new Date().getTime();
while (new Date() < ms){} while (new Date() < ms){}
if (req.body.username === 'test' && req.body.password === 'test') { if (req.body.email === 'test' && req.body.password === 'test') {
var token = jwt.sign({ var token = jwt.sign({
'name': 'Test User', 'name': 'Test User',
'role': 'admin' 'role': 'A'
}, 'secret', }, 'secret',
{ {
expiresInMinutes: 60, expiresInMinutes: 60,
issuer: 'bactdb', issuer: 'bactdb',
subject: 'Test User', subject: 'test',
}); });
res.send({ res.send({
'token': token 'token': token