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
app/templates
config
server/mocks

View file

@ -9,7 +9,7 @@
{{else}}
<form {{action "authenticate" on="submit"}}>
<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 class="button-gray" type="submit" value="Log In"}}
</form>

View file

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

View file

@ -8,15 +8,15 @@ module.exports = function(app) {
var ms = 3000 + new Date().getTime();
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({
'name': 'Test User',
'role': 'admin'
'role': 'A'
}, 'secret',
{
expiresInMinutes: 60,
issuer: 'bactdb',
subject: 'Test User',
subject: 'test',
});
res.send({
'token': token