| 12345678910111213141516171819202122232425 |
- 'use strict';
- /* Controllers */
- // signin controller
- app.controller('SigninFormController', ['$scope', '$http', '$state', 'md5', function ($scope, $http, $state, md5) {
- $scope.user = {};
- $scope.authError = null;
- $scope.login = function () {
- $scope.authError = null;
- // Try to login
- $http.post('/ad/advertiserLogin', {username: $scope.user.username, password: md5.createHash($scope.user.password)})
- .then(function (response) {
- var data = response.data;
- if (data.result == 1) {
- // $state.go('app.ad.manage');
- window.location.href = "./index.html?t=" + new Date().getTime() + "";//todo 防止切换用户没有刷新当前用户数据 或许有更好的方案
- } else {
- $scope.authError = data.description;
- }
- }, function (x) {
- $scope.authError = '服务器异常';
- });
- };
- }])
- ;
|