auth-component
Advanced tools
Comparing version 3.0.4 to 3.1.0
{ | ||
"name": "auth-component", | ||
"version": "3.0.4", | ||
"version": "3.1.0", | ||
"description": "Simple authentication utilities for DoneJS", | ||
@@ -65,20 +65,23 @@ "homepage": "https://github.com/icanjs/auth-component", | ||
"dependencies": { | ||
"can-component": "^3.0.0-pre.14", | ||
"can-define": "^0.7.7", | ||
"can-component": "^3.0.0-pre.16", | ||
"can-define": "^0.8.2", | ||
"can-route": "^3.0.0-pre.9", | ||
"can-stache": "^3.0.0-pre.11", | ||
"can-stache": "^3.0.0-pre.21", | ||
"can-stache-bindings": "^3.0.0-pre.23", | ||
"steal-stache": "^3.0.0-pre.3" | ||
}, | ||
"devDependencies": { | ||
"can-route": "^3.0.0-pre.18", | ||
"can-view-autorender": "^3.0.0-pre.4", | ||
"cssify": "^0.6.0", | ||
"documentjs": "^0.4.2", | ||
"done-serve": "^0.2.0", | ||
"donejs-cli": "^0.9.4", | ||
"generator-donejs": "^0.9.0", | ||
"jshint": "^2.9.1", | ||
"cssify": "^0.6.0", | ||
"steal": "^0.16.0", | ||
"steal": "^0.16.37", | ||
"steal-qunit": "^0.1.1", | ||
"steal-tools": "^0.16.0", | ||
"testee": "^0.2.4", | ||
"generator-donejs": "^0.9.0", | ||
"donejs-cli": "^0.9.4", | ||
"done-serve": "^0.2.0" | ||
"testee": "^0.2.4" | ||
} | ||
} |
@@ -9,2 +9,4 @@ # auth-component | ||
![auth-component UI](auth-component.jpg) | ||
## Usage | ||
@@ -11,0 +13,0 @@ |
@@ -18,4 +18,3 @@ import QUnit from 'steal-qunit'; | ||
QUnit.equal(vm.localSignup, false, 'Signup disabled by default'); | ||
QUnit.equal(vm.routeAttrName, 'subpage', 'Default route attribute is "subpage".'); | ||
QUnit.equal(vm.routeAttr, undefined, 'Default route attribute is "subpage".'); | ||
QUnit.equal(vm.activeTab, 'login', 'Default activeTab attribute is "login".'); | ||
QUnit.equal(vm.email, undefined, 'No default email.'); | ||
@@ -22,0 +21,0 @@ QUnit.equal(vm.password, undefined, 'No default password.'); |
import Component from 'can-component'; | ||
import DefineMap from 'can-define/map/'; | ||
import route from 'can-route'; | ||
import './auth.less!'; | ||
@@ -14,4 +13,17 @@ import template from './auth.stache'; | ||
local: { | ||
type: 'string' | ||
}, | ||
/** | ||
* Determines if signup controls are visible in the UI. Any values other than | ||
* `none` and `false` will be interpreted as `true`. | ||
*/ | ||
localSignup: { | ||
value: false, | ||
set(val){ | ||
val = val || 'password'; | ||
if (val === 'none' || val === 'false') { | ||
val = false; | ||
} else { | ||
val = true; | ||
} | ||
return val; | ||
@@ -107,22 +119,8 @@ } | ||
/** | ||
* Determines if signup controls are visible in the UI. Valid values include | ||
* `none` and `false`. | ||
*/ | ||
localSignup: { | ||
value: false, | ||
set(val){ | ||
if (val === 'none' || val === 'false') { | ||
val = false; | ||
} else { | ||
val = true; | ||
} | ||
return val; | ||
} | ||
}, | ||
/** | ||
* The `session` is bound out to the appstate's `session`, so we can update | ||
* the appstate's session once the user has logged in. | ||
*/ | ||
session: {}, | ||
session: { | ||
type: '*' | ||
}, | ||
@@ -132,18 +130,14 @@ sessionModel: {}, | ||
/** | ||
* Set the `routeAttrName` to the attribute in the route that the component | ||
* should watch to determine which tab to show and to handle OAuth login failure. | ||
* The name of the currently active tab. Bind this to an attribute in your routes | ||
* to make it update the route. | ||
*/ | ||
routeAttrName: { | ||
value: 'subpage' | ||
activeTab: { | ||
value() { | ||
if(this.localSignup){ | ||
return 'signup'; | ||
} | ||
return 'login'; | ||
} | ||
}, | ||
/** | ||
* `routeAttr` returns the value held in the `routeAttrName` of can.route. | ||
*/ | ||
routeAttr: { | ||
get(){ | ||
return route[this.routeAttrName]; | ||
} | ||
}, | ||
email: { | ||
@@ -176,4 +170,3 @@ type: 'string' | ||
ViewModel, | ||
template, | ||
leakScope: true | ||
template | ||
}); |
@@ -7,8 +7,14 @@ import Component from 'can-component'; | ||
export const ViewModel = DefineMap.extend({ | ||
define: { | ||
// The baseUrl of the OAuth server to which you're authenticating. | ||
baseUrl: { | ||
value: '' | ||
} | ||
} | ||
// The baseUrl of the OAuth server to which you're authenticating. | ||
baseUrl: { | ||
value: '' | ||
}, | ||
activeTab: { | ||
type: 'string' | ||
}, | ||
setActiveTab(tabName) { | ||
this.activeTab = tabName; | ||
}, | ||
}); | ||
@@ -18,5 +24,5 @@ | ||
tag: 'auth-ui', | ||
ViewModel: ViewModel, | ||
ViewModel, | ||
template, | ||
leakScope: true | ||
leakScope: true | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
314281
69
340
79
6
12
+ Addedcan-define@0.8.6(transitive)
- Removedcan-define@0.7.29(transitive)
Updatedcan-component@^3.0.0-pre.16
Updatedcan-define@^0.8.2
Updatedcan-stache@^3.0.0-pre.21