-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b0c5891
Showing
234 changed files
with
22,614 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/bower_components | ||
/node_modules | ||
/.sass-cache | ||
/public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Synergy Default Theme | ||
=== | ||
|
||
## Gulp | ||
Gulp is used for running common tasks such as: | ||
- Less -> CSS compilation | ||
- JS compilation | ||
- Preparation for licensing | ||
- And more. | ||
|
||
To run the default gulp task, make sure `gulp` is installed globally and then run `gulp` from the root directory of this theme. For front-end developers, use `gulp watch` to automatically update JS and CSS files on change. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
angular | ||
.module('app', [ | ||
'app.core', | ||
'app.auth', | ||
'app.dashboard', | ||
'app.layout', | ||
'app.user' | ||
]); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
angular | ||
.module('app.auth') | ||
.service('ApiKey', ApiKey); | ||
|
||
/** | ||
* ApiKey Service | ||
* | ||
* @ngInject | ||
*/ | ||
function ApiKey ($localStorage) { | ||
var apiKey = this; | ||
var _apiKey = getApiKeyFromStorage(); | ||
|
||
apiKey.get = getApiKey; | ||
apiKey.set = setApiKey; | ||
apiKey.id = getApiKeyId; | ||
apiKey.delete = deleteApiKey; | ||
|
||
function getApiKey() { | ||
return _apiKey ? _apiKey.key : null; | ||
} | ||
|
||
function getApiKeyId() { | ||
return _apiKey ? _apiKey.id : null; | ||
} | ||
|
||
function setApiKey(key, remember) { | ||
_apiKey = { | ||
id: key.id, | ||
key: key.key | ||
}; | ||
|
||
$localStorage.apiKey = _apiKey; | ||
} | ||
|
||
function getApiKeyFromStorage() { | ||
return $localStorage.apiKey || null; | ||
} | ||
|
||
/** | ||
* Delete this API Key from local storage. | ||
*/ | ||
function deleteApiKey() { | ||
_apiKey = null; | ||
delete $localStorage.apiKey; | ||
} | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
angular | ||
.module('app.auth', [ | ||
'restangular' | ||
]); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
(function() { | ||
'use strict'; | ||
|
||
angular | ||
.module('app.auth') | ||
.provider('Auth', AuthProvider) | ||
; | ||
|
||
function AuthProvider() { | ||
var authProvider = this; | ||
var internalApi = { | ||
$get: getService | ||
}; | ||
|
||
return internalApi; | ||
|
||
/** | ||
* @ngInject | ||
*/ | ||
function getService(Api, ApiKey, $state) { | ||
return new Auth(Api, ApiKey, $state); | ||
} | ||
|
||
/** | ||
* Auth Service | ||
*/ | ||
function Auth(Api, ApiKey, $state) { | ||
var auth = this; | ||
var keys = Api.all('key'); | ||
|
||
auth.logout = logout; | ||
auth.login = login; | ||
|
||
///////////// | ||
|
||
/** | ||
* Revoke this API Key, | ||
* so that all of the user's browser instances | ||
* are logged out of the application. | ||
* | ||
* @return {promise} | ||
*/ | ||
function logout() { | ||
return keys.one(""+ApiKey.id()).remove() | ||
.then(ApiKey.delete, ApiKey.delete) | ||
.then(transferToLogin, transferToLogin) | ||
; | ||
} | ||
|
||
/** | ||
* @param object credentials | ||
* @param boolean remember | ||
*/ | ||
function login(credentials, remember) { | ||
return keys | ||
.post(credentials) | ||
.then(handleResponse.bind(null, remember)) | ||
.then(transferToApp) | ||
; | ||
} | ||
|
||
function handleResponse(remember, response) { | ||
ApiKey.set(response, remember); | ||
} | ||
|
||
function transferToApp() { | ||
// TODO: attempted URL | ||
$state.go('app.dashboard'); | ||
} | ||
|
||
function transferToLogin() { | ||
$state.go('auth.login'); | ||
} | ||
} | ||
} | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
(function () { | ||
angular | ||
.module('app.auth') | ||
.config(routeConfig); | ||
|
||
/** | ||
* @ngInject | ||
*/ | ||
function routeConfig($stateProvider, RouteHelpersProvider) { | ||
var helper = RouteHelpersProvider; | ||
$stateProvider | ||
.state('auth', { | ||
url: '/auth', | ||
abstract: true, | ||
templateUrl: helper.basepath('auth/page.html'), | ||
resolveFor: helper.resolveFor([ | ||
'icons' | ||
]) | ||
}) | ||
.state('auth.login', { | ||
url: '/login', | ||
title: 'Login', | ||
templateUrl: helper.basepath('auth/login.html') | ||
}) | ||
.state('auth.logout', { | ||
url: '/logout', | ||
title: 'Logout', | ||
template: '', | ||
controller: 'LogoutCtrl' | ||
}) | ||
.state('auth.recover', { | ||
url: '/recover', | ||
title: 'Recover', | ||
templateUrl: helper.basepath('auth/recover.html') | ||
}) | ||
; | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/**========================================================= | ||
* Module: access-login.js | ||
* Demo for login api | ||
=========================================================*/ | ||
|
||
(function () { | ||
'use strict'; | ||
|
||
angular | ||
.module('app.auth') | ||
.controller('AuthLoginController', AuthLoginController); | ||
|
||
/** | ||
* @ngInject | ||
*/ | ||
function AuthLoginController(Auth, $state) { | ||
var vm = this; | ||
|
||
vm.type = 'admin'; | ||
|
||
activate(); | ||
|
||
//////////////// | ||
|
||
function activate() { | ||
// Bound form data | ||
vm.account = { | ||
username: "", | ||
password: "" | ||
}; | ||
vm.loginForm = null; | ||
|
||
// Error message | ||
vm.authMsg = ''; | ||
|
||
vm.login = handleLoginForm; | ||
} | ||
|
||
function handleLoginForm() { | ||
vm.authMsg = ''; | ||
|
||
if (!vm.loginForm.$valid) { | ||
// set as dirty if the user click directly to login, | ||
// so we show the validation messages. | ||
vm.loginForm.username.$dirty = vm.loginForm.password.$dirty = true; | ||
|
||
return; | ||
} | ||
|
||
var remember = false; // TODO | ||
|
||
Auth.login(credentials(), remember) | ||
.catch(handleError); | ||
} | ||
|
||
function credentials() { | ||
return { | ||
type: vm.type, | ||
username: vm.account.username, | ||
password: vm.account.password | ||
}; | ||
} | ||
|
||
function handleError(error) { | ||
console.error(error); | ||
} | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
doctype html | ||
.block-center.mt-xl.wd-xl(ng-controller="AuthLoginController as login") | ||
// START panel | ||
.panel.panel-inverse.panel-flat | ||
.panel-heading.text-center | ||
.logo | ||
| {{ 'app.title' | translate }} | ||
.panel-body | ||
p.text-center.pv | ||
| {{ 'auth.login.SIGNIN' | translate }} | ||
form.form-validate.mb-lg( | ||
role='form' | ||
ng-submit="login.login()" | ||
name='login.loginForm' | ||
novalidate='' | ||
) | ||
.form-group.has-feedback | ||
input.form-control( | ||
type="text" | ||
name="username" | ||
placeholder="{{ 'auth.login.input.username.PLACEHOLDER' | translate }}" | ||
autocomplete="off" | ||
ng-model="login.account.username" | ||
required | ||
) | ||
span.fa.fa-envelope.form-control-feedback.text-muted | ||
span.text-danger( | ||
ng-show="login.loginForm.username.$dirty && login.loginForm.username.$error.required" | ||
) This field is required | ||
span.text-danger( | ||
ng-show="login.loginForm.username.$dirty && login.loginForm.username.$error.email" | ||
) This field must be a valid email address | ||
.form-group.has-feedback | ||
input.form-control( | ||
type='password' | ||
name="password" | ||
placeholder="{{ 'auth.login.input.password.PLACEHOLDER' | translate }}" | ||
ng-model="login.account.password" | ||
required='' | ||
) | ||
span.fa.fa-lock.form-control-feedback.text-muted | ||
span.text-danger( | ||
ng-show="login.loginForm.password.$dirty && login.loginForm.password.$error.required" | ||
) This field is required | ||
.clearfix | ||
.checkbox.c-checkbox.pull-left.mt0 | ||
label | ||
input( | ||
type='checkbox' | ||
value='' | ||
name="account_remember" | ||
ng-model="login.account.remember" | ||
) | ||
| {{ 'auth.login.REMEMBER' | translate }} | ||
.pull-right | ||
a.text-muted(ui-sref="auth.recover") | ||
| {{ 'auth.login.FORGOT' | translate }} | ||
|
||
button.btn.btn-block.btn-primary.mt-lg(type='submit') | ||
| {{ 'auth.login.LOGIN' | translate }} | ||
|
||
.alert.alert-danger.text-center(ng-show='login.authMsg') {{login.authMsg}} | ||
// END panel | ||
.p-lg.text-center | ||
span © | ||
span(ng-bind="app.year") | ||
span - | ||
span(ng-bind="app.name") | ||
br | ||
span(ng-bind="app.description") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
angular | ||
.module('app.auth') | ||
.controller('LogoutCtrl', LogoutCtrl) | ||
; | ||
|
||
/** | ||
* Logout Controller | ||
* | ||
* @ngInject | ||
*/ | ||
function LogoutCtrl(Auth) { | ||
var vm = this; | ||
|
||
activate(); | ||
|
||
////////// | ||
|
||
function activate() { | ||
Auth.logout(); | ||
} | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.auth-page.ng-zoomBackDown.ng-fluid(ui-view='', autoscroll='false') |
Oops, something went wrong.