Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38d7176
commit 8725ece
Showing
5 changed files
with
73 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,22 @@ | ||
'use strict' | ||
|
||
angular.module('workbaseApp').controller('LoginCtrl', ['$scope', function( | ||
$scope) { | ||
$scope.opLogin = true; | ||
}]); | ||
angular.module('workbaseApp').controller('LoginCtrl', ['$scope', '$meteor', | ||
function( | ||
$scope, $meteor) { | ||
$scope.user = { | ||
username: 'user01', | ||
password: '123' | ||
} | ||
|
||
$scope.login = function(user) { | ||
$meteor.loginWithPassword(user.username, user.password) | ||
.then(function() { | ||
console.log('login success'); | ||
console.log($scope.currentUser); | ||
}, function(err) { | ||
console.log(err); | ||
}); | ||
} | ||
|
||
} | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict' | ||
|
||
angular.module('workbaseApp').controller('RegisterCtrl', ['$scope', '$meteor', | ||
function($scope, $meteor) { | ||
|
||
$scope.user = { | ||
username: 'user01', | ||
password: '123', | ||
confirmPwd: '123', | ||
nick: 'nick01', | ||
mobile: '13585513045' | ||
} | ||
|
||
$scope.createUser = function(user) { | ||
$meteor.createUser({ | ||
username: user.username, | ||
password: user.password, | ||
profile: { | ||
nick: user.nick, | ||
mobile: user.mobile | ||
} | ||
}).then(function() { | ||
console.log('register success'); | ||
console.log($scope.currentUser); | ||
}, function(err) { | ||
console.log('register error - ', err); | ||
}); | ||
} | ||
} | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,23 @@ | ||
<div class="col-md-3 col-md-offset-3"> | ||
<form> | ||
<form ng-submit="login(user)"> | ||
<div class="form-group"> | ||
<input type="text" class="form-control" ng-model="user.loginName" placeholder="用户名"> | ||
</div> | ||
<div class="form-group" ng-hide="opLogin"> | ||
<input type="text" class="form-control" ng-model="user.mobile" placeholder="手机号码"> | ||
</div> | ||
<div class="form-group" ng-hide="opLogin"> | ||
<input type="text" class="form-control" ng-model="user.nick" placeholder="昵称"> | ||
<input type="text" class="form-control" ng-model="user.username" placeholder="用户名"> | ||
</div> | ||
<div class="form-group"> | ||
<input type="password" class="form-control" ng-model="user.password" placeholder="密码"> | ||
<!-- <p class="help-block">Example block-level help text here.</p> --> | ||
</div> | ||
<div class="form-group" ng-hide="opLogin"> | ||
<input type="password" class="form-control" ng-model="confirPwd" placeholder="验证"> | ||
</div> | ||
<div class="checkbox" ng-show="opLogin"> | ||
<div class="checkbox"> | ||
<label> | ||
<input type="checkbox"> 自动登录 | ||
</label> | ||
</div> | ||
<div ng-show="opLogin"> | ||
<div> | ||
<button type="submit" class="btn btn-primary" style="margin-right:3em;">登 录</button> | ||
<a style="cursor:pointer;" ng-click="opLogin=false">忘记密码</a> | ||
</div> | ||
<div ng-show="opLogin" class="pull-right"> | ||
我还没有创建 <a style="cursor:pointer;" ng-click="opLogin=false">创建新账户</a> | ||
<a style="cursor:pointer;" ui-sref="findpwd">忘记密码</a> | ||
</div> | ||
<div ng-hide="opLogin"> | ||
<button type="submit" class="btn btn-primary" style="margin-right:3em;">注 册</button> | ||
我已经注册过账户 <a style="cursor:pointer;" ng-click="opLogin=true">请登录</a> | ||
<div class="pull-right"> | ||
我还没有创建 <a style="cursor:pointer;" ui-sref="register">创建新账户</a> | ||
</div> | ||
</form> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,24 @@ | ||
<div class="col-md-3 col-md-offset-3"> | ||
<form> | ||
<form ng-submit="createUser(user)"> | ||
<div class="form-group"> | ||
<input type="text" class="form-control" ng-model="user.loginName" placeholder="用户名"> | ||
<input type="text" class="form-control" ng-model="user.username" placeholder="用户名"> | ||
</div> | ||
<div class="form-group" ng-hide="opLogin"> | ||
<div class="form-group"> | ||
<input type="text" class="form-control" ng-model="user.mobile" placeholder="手机号码"> | ||
</div> | ||
<div class="form-group" ng-hide="opLogin"> | ||
<div class="form-group"> | ||
<input type="text" class="form-control" ng-model="user.nick" placeholder="昵称"> | ||
</div> | ||
<div class="form-group"> | ||
<input type="password" class="form-control" ng-model="user.password" placeholder="密码"> | ||
<!-- <p class="help-block">Example block-level help text here.</p> --> | ||
</div> | ||
<div class="form-group" ng-hide="opLogin"> | ||
<input type="password" class="form-control" ng-model="confirPwd" placeholder="验证"> | ||
</div> | ||
<div class="checkbox" ng-show="opLogin"> | ||
<label> | ||
<input type="checkbox"> 自动登录 | ||
</label> | ||
</div> | ||
<div ng-show="opLogin"> | ||
<button type="submit" class="btn btn-primary" style="margin-right:3em;">登 录</button> | ||
<a style="cursor:pointer;" ng-click="opLogin=false">忘记密码</a> | ||
</div> | ||
<div ng-show="opLogin" class="pull-right"> | ||
我还没有创建 <a style="cursor:pointer;" ng-click="opLogin=false">创建新账户</a> | ||
<div class="form-group"> | ||
<input type="password" class="form-control" ng-model="user.confirmPwd" placeholder="验证"> | ||
</div> | ||
<div ng-hide="opLogin"> | ||
<div> | ||
<button type="submit" class="btn btn-primary" style="margin-right:3em;">注 册</button> | ||
我已经注册过账户 <a style="cursor:pointer;" ng-click="opLogin=true">请登录</a> | ||
我已经注册过账户 <a style="cursor:pointer;" ui-sref="login">请登录</a> | ||
</div> | ||
</form> | ||
</div> |