Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"env": {
"es6": true
},
"parserOptions": {
"ecmaVersion": 2017
},
"rules": {
"arrow-body-style": 2,
"arrow-parens": 2,
"arrow-spacing": 2,
"accessor-pairs": 2,
"array-bracket-newline": 2,
"array-bracket-spacing": 2,
"array-element-newline": 2,

"block-scoped-var": 0,
"block-spacing": 2,

"class-methods-use-this": 2,
"comma-dangle": 2,
"comma-spacing": 2,
"comma-style": 2,
"computed-property-spacing": 2,
"constructor-super": 2,
"curly": 2,
"brace-style": 2,
"eol-last": 2,

"function-paren-newline": 2,

"handle-callback-err": 2,

"id-match": 2,

"key-spacing": 2,
"keyword-spacing": 2,

"multiline-comment-style": 2,

"yoda": 2,

"space-before-blocks": 2,
"space-before-function-paren": 2,
"space-in-parens": 2,
"space-infix-ops": 2,
"space-unary-ops": 2,
"spaced-comment": 2,

"indent": ["error", 2, {
"SwitchCase": 1
}],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
]
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ tmp
.project
.settings
Thumbs.db
.vscode/appc
Binary file modified Resources/.DS_Store
Binary file not shown.
24 changes: 13 additions & 11 deletions app/alloy.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// The contents of this file will be executed before any of
// your view controllers are ever executed, including the index.
// You have access to all functionality on the `Alloy` namespace.
//
// This is a great place to do any initialization for your app
// or create any global variables/functions that you'd like to
// make available throughout your app. You can easily make things
// accessible globally by attaching them to the `Alloy.Globals`
// object. For example:
//
// Alloy.Globals.someGlobalFunction = function(){};
/*
* The contents of this file will be executed before any of
* your view controllers are ever executed, including the index.
* You have access to all functionality on the `Alloy` namespace.
*
* This is a great place to do any initialization for your app
* or create any global variables/functions that you'd like to
* make available throughout your app. You can easily make things
* accessible globally by attaching them to the `Alloy.Globals`
* object. For example:
*
* Alloy.Globals.someGlobalFunction = function(){};
*/
27 changes: 26 additions & 1 deletion app/controllers/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,11 @@
* @param sites
*/
function tryLogin (username, password, sites) {
let client = ;// Buggy code
var networkClient = network.getNetworkClient();
networkClient.init(sites[0]);
networkClient
.login(username, password)
.login("administrator", "password")
.then(function (result) {
stopLoading();
if (result.result.status !== "success") {
Expand Down Expand Up @@ -261,6 +262,30 @@
})
.done(function () {
stopLoading();
if (result.result.status !== "success") {
if (sites.length > 1) {
sites.shift();
return tryLogin(username, password, sites);
} else {
alert(result.result.messages.join("\n"));
}
} else {
Alloy.Globals.UserSession.setUser(result.data);
Alloy.Globals.UserSession.setValue("site", sites[0]);
if (require("services/system").isDevelopmentMode()) {
Alloy.Globals.UserSession.setValue(
"username",
result.data.username
);
}
LogManager.info("Login: " + result.data.username + " logged in");
Alloy.Globals.LogManager.info("[NAVIGATION] Current page :" + "Home");

Alloy.createController("home")
.getView()
.open();
$.loginWindow.close();
}
});
}

Expand Down
Loading