登录请求时,我发送的是id,密码&作为回报,我获得了唯一的令牌密钥,uid,电子邮件和& uname并将它们保存在本地。用户登录后,如果我刷新页面,标题更改&再次要求登录。如何在页面刷新后保留这些值。 这是我的代码: -
angular.module('feApp').controller('LoginCtrl', function($scope, $rootScope, $uibModalInstance, login, appSettings, appServices, lclStorage) {
$scope.userLogin = function() {
var checkbox = $("#rememberme"),
userPwd = $("#regU_Pwd")
var requestParam = {
"email_id": $scope.user.email_id,
"password": $scope.user.password
}
if (checkbox.prop('checked')) {
lclStorage.set('user_Det.user_name', $('#regU_Id').val())
lclStorage.set('user_Det.user_pwd', $('#regU_Pwd').val())
};
appServices.doAPIRequest(appSettings.appAPI_ci.logininfo.overviewData, requestParam, null, 'userData').then(function(data) {
$scope.bookmarkData = data.Bookmarked_careers;
$rootScope.userDetails = data.User_details;
$scope.error_Message = data.errors;
$scope.loginStatus = data.message;
if ($scope.loginStatus == 'success') {
$scope.login = login;
$scope.login.showLogin = false;
$uibModalInstance.close($scope.login);
$rootScope.login_Status = "true";
lclStorage.set('userDetails', $scope.userDetails)
} else {
$(".login_Alert").removeClass('hidden');
$rootScope.login_Status = "false";
}
});
}
});