Skip to content

Commit

Permalink
Merge branch 'hotfix/register-err' into webapp
Browse files Browse the repository at this point in the history
* hotfix/register-err:
  WA修正:解决注册问题
  mb-code:log
  mb-code:loadZip token
  mb-code:本地添加
  手指滑动
  mc-code:pageModel
  mb-code:本地获取图片
  mb-code:选择图片
  mb-code:本地
  mb-code:fix style
  mb代码:init local project
  mb代码:删除Android-Protoshop工程
  wb代码:测试
  init
  格式化
  • Loading branch information
amio committed Mar 13, 2014
2 parents 6fa803b + cb5813d commit fddce56
Showing 1 changed file with 31 additions and 20 deletions.
51 changes: 31 additions & 20 deletions app/scripts/controllers/register.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
'use strict';

angular.module('toHELL')
.controller('RegisterCTRL', ['$scope', '$location', '$http', 'GLOBAL', 'loginService',
function ($scope, $location, $http, GLOBAL, loginService) {
$scope.doSignup = function () {
$http.post(GLOBAL.apiHost + 'register/', $scope.user)
.success(function (res) {
switch (res.status) {
case '1':
loginService.doLogin($scope.user, function () {
$location.path('/list/');
});
break;
default:
var errDesc = GLOBAL.errDesc[res.error_code] || '未知错误';
alert(errDesc);
console.log('Signup Error: ', errDesc, res);
}
})
.error(GLOBAL.errLogger);
}
}]);
.controller('RegisterCTRL', ['$scope', '$location', '$http', 'GLOBAL', 'loginService',
function ($scope, $location, $http, GLOBAL, loginService) {
$scope.doSignup = function () {

// 将密码做 MD5 转换
var account = {
email: $scope.user.email,
passwd: V.Security.md5($scope.user.passwd)
};

// 注册
$http.post(GLOBAL.apiHost + 'register/', account)
.success(function (res) {
switch (res.status) {
case '1':
// 注册成功后
// 以用户原始输入的账号信息进行自动登陆
loginService.doLogin($scope.user, function () {
$location.path('/list/');
});
break;
default:
var errDesc = GLOBAL.errDesc[res.error_code] || '未知错误';
alert(errDesc);
console.log('Signup Error: ', errDesc, res);
}
})
.error(GLOBAL.errLogger);
}
}
]);

0 comments on commit fddce56

Please sign in to comment.