Complete the login feature

This commit is contained in:
Andrew Miner
2015-04-01 13:31:07 -07:00
parent 764f835698
commit ad897b80c0
10 changed files with 253 additions and 60 deletions
+33
View File
@@ -0,0 +1,33 @@
###
Crafting Guide - user.coffee
Copyright (c) 2015 by Redwood Labs
All rights reserved.
###
BaseModel = require './base_model'
{Url} = require '../constants'
########################################################################################################################
module.exports = class GitHubUser extends BaseModel
constructor: (attributes={}, options={})->
attributes.avatarUrl ?= null
attributes.email ?= null
attributes.login ?= null
attributes.name ?= null
super attributes, options
# Property Methods #############################################################################
isAuthenticated: ->
return @login?
Object.defineProperties @prototype,
authenticated: {get:@prototype.isAuthenticated}
# Object Overrides #############################################################################
toString: ->
return "#{@name} (#{@login})"