// check if we are logged in..
new Pman.Request({
url: baseURL + '/Login',
- method: 'GET',
+ method: 'POST',
params: {
getAuthUser: true
},
//console.log('call failure');
return Pman.Login.failure(response,opts);
}
+
if (res.data.id*1 < 0) {
this.fillAuth(res.data);
return this.openSystem();
var _this = this;
if (!res.data.id) { // id=0 == login failure.
- return Pman.Dialog.Login.show({},
+
+ if(window.location.pathname.substr(baseURL.length).match(/\/PasswordReset\//)){
+ Pman.Dialog.BAdminPasswordReset.show({}, function(){
+ window.location.href = baseURL;
+ });
+
+ return;
+ }
+
+
+
+ return Pman.Dialog.Login.show(
+ {},
function(data) {
Pman.Login.success(data);
}
params: {
getAuthUser: true
},
- method: 'GET',
+ method: 'POST',
success: Pman.Login.success,
failure : Pman.Login.failure,
scope : Pman.Login
window.onbeforeunload = false;
document.location = baseURL + '?ts=' + Math.random();
},
+
openSystemCreateCompany: function(data)
{
-
if (Pman.Login.authUser.company_id * 1 > 0) {
//forceAdmin();
- Pman.Login.openSystemCreateUser(data);
+ Pman.Login.openSystemCreateUser(data);
return;
}
if (!data || !data.id) {
{
Roo.bootstrap.MessageBox.alert("Error", "Admin accounts have not been created - use the old admin at present");
- if (Pman.Login.authUser.company_id* 1 <= 0) {
- this.openSystemCreateCompany();
- return;
- }
-
- if (Pman.Login.authUser.id* 1 <= 0) {
- this.openSystemCreateUser();
- return;
- }
+ new Pman.Request({
+ url: baseURL + '/Login',
+ method: 'POST',
+ params: {
+ check_owner_company: true
+ },
+ success: function(res) { // check successfull...
+
+ if(res.data == 1) {
+ this.openSystemCreateUser();
+ return;
+ }
+
+ if(res.data == 0) {
+ this.openSystemCreateCompany();
+ return;
+ }
+
+ if(res.data > 0) {
+ Roo.bootstrap.MessageBox.alert(
+ "Error",
+ "There are more than 1 company in the system. please fix the data"
+ );
+ return;
+ }
+ },
+ failure : function(res)
+ {
+ Roo.bootstrap.MessageBox.alert(
+ "Error",
+ "Invalid params for check owner company"
+ );
+ },
+ scope : Pman.Login
+ });
},
/**
* hasPerm: