-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/register-err' into webapp
* 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
Showing
1 changed file
with
31 additions
and
20 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,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); | ||
} | ||
} | ||
]); |