nodulator
Version:
Complete NodeJS Framework for Restfull APIs
44 lines (37 loc) • 914 B
text/coffeescript
class AuthDirective extends N.Directive 'auth', '$window', '$http', 'userService'
state: 'login'
ident:
username: 'test'
password: 'test'
Auth: ->
.post('/api/1/clients/login', )
.success =>
.location.href = '/'
.error (data) =>
= data
setTimeout =>
=>
= ''
, 10000
Signup: ->
if .password isnt .password2
= 'Passwords doesn\'t match'
setTimeout =>
=>
= ''
, 10000
.post('/api/1/clients', )
.success =>
.error (data) =>
= data
setTimeout =>
=>
= ''
, 10000
Toggle: ->
if is 'login'
= 'signup'
else if is 'signup'
= 'login'
AuthDirective.Init()