我从服务器上获得了一个项目,我在本地部署了该项目,导出了数据库,并将本地主机的文件“ c:/ windows / system32 / hosts”更改为dev.project_name。
#
127.0.0.1 dev.project_name
::1 localhost
我与xampp一起工作,所以我修改了appache文件“ C:\ xampp \ apache \ conf \ extra / httpd-vhost”以为端口80和端口443创建虚拟主机,
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "C:/xampp/htdocs/project_name"
ServerName dev.project_name
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "C:/xampp/htdocs/project_name"
ServerName dev.project_name
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
我还更改了文件“ parameters.yml”中的数据,该文件将数据库的参数放在本地。
parameters:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: 3306
database_name: db_project
database_user: root
database_password:
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
mailer_encryption:
mailer_port:
我使用命令“ php应用程序/控制台学说:数据库:创建”进行了测试,以检查与数据库的连接,并且一切正常,数据库创建良好,但是当我本地连接到网站时,我无法用登录名和密码通常可以在网站上在线运行,尽管我已经导出了本地数据库中的所有表。
这是loginController.js的代码
angular
.module('altairApp')
.controller('loginCtrl', [
'$scope',
'$rootScope',
'utils',
'$location', 'toaster','AuthenticationService', 'UserService',
function ($scope,$rootScope,utils, $location, toaster, AuthenticationService, UserService) {
(function initController() {
$scope.user = {};
$scope.data = {};
$scope.loading = false;
// reset login status
AuthenticationService.ClearCredentials();
})();
//Form Validation
var $formValidate = $('#user_login_form');
var $formValidateForgot = $('#forgot_password');
//$formValidate.parsley().validate()
$formValidate
.parsley({
'excluded': 'input[type=button], input[type=submit], input[type=reset], input[type=hidden], .selectize-input > input'
})
.on('form:validated',function() {
$scope.$apply();
})
.on('field:validated',function(parsleyField) {
if($(parsleyField.$element).hasClass('md-input')) {
$scope.$apply();
}
});
$formValidateForgot
.parsley({
'excluded': 'input[type=button], input[type=submit], input[type=reset], input[type=hidden], .selectize-input > input'
})
.on('form:validated',function() {
$scope.$apply();
})
.on('field:validated',function(parsleyField) {
if($(parsleyField.$element).hasClass('md-input')) {
$scope.$apply();
}
});
$scope.registerFormActive = false;
var $login_card = $('#login_card'),
$login_form = $('#login_form'),
$login_help = $('#login_help'),
$register_form = $('#register_form'),
$login_password_reset = $('#login_password_reset');
// show login form (hide other forms)
var login_form_show = function() {
$login_form
.show()
.siblings()
.hide();
};
// show register form (hide other forms)
var register_form_show = function() {
$register_form
.show()
.siblings()
.hide();
};
// show login help (hide other forms)
var login_help_show = function() {
$login_help
.show()
.siblings()
.hide();
};
// show password reset form (hide other forms)
var password_reset_show = function() {
$login_password_reset
.show()
.siblings()
.hide();
};
$scope.loginHelp = function($event) {
$event.preventDefault();
utils.card_show_hide($login_card,undefined,login_help_show,undefined);
};
$scope.backToLogin = function($event) {
$event.preventDefault();
$scope.registerFormActive = false;
utils.card_show_hide($login_card,undefined,login_form_show,undefined);
};
$scope.registerForm = function($event) {
$event.preventDefault();
$scope.registerFormActive = true;
utils.card_show_hide($login_card,undefined,register_form_show,undefined);
};
$scope.passwordForgot = function($event) {
$event.preventDefault();
utils.card_show_hide($login_card,undefined,password_reset_show,undefined);
};
$scope.login = function(user) {
if($('#user_login_form').parsley().isValid()) {
$scope.login_loading = true;
AuthenticationService.Login(user, function (response) {
response.status=true;
console.log(response);
if (response.status) {
AuthenticationService.SetCredentials(JSON.parse(response.data), $scope.user.password);
$scope.login_loading = false;
toaster.pop('success', "Login", response.message);
$location.path('/dashboard');
} else {
$scope.login_loading = false;
toaster.pop('error', "Login", response.message);
}
});
}
}
$scope.forgotPassword = function(email) {
if($('#forgot_password').parsley().isValid()) {
$scope.loading = true;
UserService.ForgotPassword(email, function (response) {
$scope.loading = false;
if (response.status) {
$scope.data = {};
// send this token to change_password api
// $scope.getUserByToken(response.token);
toaster.pop('success', "Forgot Password", response.message);
} else {
toaster.pop('error', "Forgot Password", response.message);
}
});
}
}
$scope.getUserByToken = function(token) {
var tokenObj = {};
tokenObj.token = token;
UserService.getUserByToken(tokenObj, function (response) {
$scope.loading = false;
if (response.status) {
var id = response.userId;
$rootScope.globals.reset_password_userId = id;
//$location.path('/reset_password');
} else {
toaster.pop('error', "Reset Password", response.message);
}
});
}
}
]);
我认为问题在于response.status和response.data不存在,我也不知道为什么。
非常感谢您