Errores en componente login solucionados
This commit is contained in:
parent
011d9d7dc9
commit
b079520f31
|
@ -1,3 +0,0 @@
|
||||||
## Client
|
|
||||||
|
|
||||||
This is the place for your application front-end files.
|
|
|
@ -1,10 +1,8 @@
|
||||||
module.exports = {
|
{
|
||||||
"extends": "google",
|
"extends": "google",
|
||||||
"installedESLint": true,
|
"installedESLint": true,
|
||||||
"rules":{
|
"rules": {
|
||||||
"indent": ["error", 4],
|
"indent": ["error", 4],
|
||||||
"require-jsdoc": 0
|
"require-jsdoc": 0
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
|
|
@ -4,7 +4,7 @@ export const $module = () => {
|
||||||
require.ensure([], () => {
|
require.ensure([], () => {
|
||||||
require('$module');
|
require('$module');
|
||||||
resolve('$module');
|
resolve('$module');
|
||||||
}, "salix.$module");
|
}, '$module');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
1132
@salix/error.log
1132
@salix/error.log
File diff suppressed because it is too large
Load Diff
|
@ -7,12 +7,12 @@ var fs = require ('fs');
|
||||||
|
|
||||||
// Routes
|
// Routes
|
||||||
|
|
||||||
var fileTpl = '\n"<%=file.path%>": <%=contents%>';
|
var fileTpl = '\n"<%=file.relative%>": <%=contents%>';
|
||||||
var globalTpl = 'var routes = {<%=contents%>\n}';
|
var globalTpl = 'var routes = {<%=contents%>\n}';
|
||||||
|
|
||||||
gulp.task ('routes', function ()
|
gulp.task ('routes', function ()
|
||||||
{
|
{
|
||||||
return gulp.src ('./**/routes.js')
|
return gulp.src ('./crud/**/routes.js')
|
||||||
.pipe (wrap (fileTpl))
|
.pipe (wrap (fileTpl))
|
||||||
.pipe (concat ('salix.routes.js', {newLine: ','}))
|
.pipe (concat ('salix.routes.js', {newLine: ','}))
|
||||||
.pipe (wrap (globalTpl))
|
.pipe (wrap (globalTpl))
|
||||||
|
|
|
@ -4,38 +4,38 @@ import style from './login.scss'
|
||||||
|
|
||||||
export const COMPONENT =
|
export const COMPONENT =
|
||||||
{
|
{
|
||||||
template: template,
|
template: template,
|
||||||
controller: function ($http)
|
controller: function ($http)
|
||||||
{
|
{
|
||||||
var self = this;
|
var self = this;
|
||||||
this.submit = function ()
|
this.submit = function ()
|
||||||
{
|
{
|
||||||
$('spinner').firstChild.MaterialSpinner.start ();
|
var model = this.model;
|
||||||
|
|
||||||
var url = '/account';
|
if (model && model.email && model.password)
|
||||||
this.model.appId = window.location.href;
|
{
|
||||||
$http.post(url, this.model).then (
|
setLoading (true);
|
||||||
onLoginOk,
|
model.appId = window.location.href;
|
||||||
onLoginErr
|
$http.post('/account', this.model).then (
|
||||||
);
|
onLoginOk,
|
||||||
|
onLoginErr
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
showMessage ('Please insert your email and password');
|
||||||
};
|
};
|
||||||
|
|
||||||
function $ (id)
|
|
||||||
{
|
|
||||||
return document.getElementById (id);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onLoginOk (response)
|
function onLoginOk (response)
|
||||||
{
|
{
|
||||||
$('spinner').firstChild.MaterialSpinner.stop ();
|
setLoading (false);
|
||||||
//sessionStorage.setItem ('token', response.data.accessToken);
|
//sessionStorage.setItem ('token', response.data.accessToken);
|
||||||
window.location = response.data.location +'?access_token='+ response.data.accessToken;
|
window.location = response.data.location +'?access_token='+ response.data.accessToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLoginErr (response)
|
function onLoginErr (response)
|
||||||
{
|
{
|
||||||
$('spinner').firstChild.MaterialSpinner.stop ();
|
setLoading (false);
|
||||||
//self.model.password = '';
|
self.model.password = '';
|
||||||
|
|
||||||
var message;
|
var message;
|
||||||
|
|
||||||
|
@ -51,19 +51,37 @@ export const COMPONENT =
|
||||||
message = 'Something went wrong';
|
message = 'Something went wrong';
|
||||||
}
|
}
|
||||||
|
|
||||||
var snackbar = $('snackbar');
|
showMessage (message);
|
||||||
snackbar.firstChild.MaterialSnackbar.showSnackbar ({
|
}
|
||||||
message: message
|
|
||||||
});
|
function $ (id)
|
||||||
|
{
|
||||||
|
return document.getElementById (id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setLoading (isLoading)
|
||||||
|
{
|
||||||
|
var spinner = $('spinner').firstChild.MaterialSpinner;
|
||||||
|
|
||||||
|
if (isLoading)
|
||||||
|
spinner.start ();
|
||||||
|
else
|
||||||
|
spinner.stop ();
|
||||||
|
}
|
||||||
|
|
||||||
|
function showMessage (message)
|
||||||
|
{
|
||||||
|
var snackbar = $('snackbar').firstChild.MaterialSnackbar;
|
||||||
|
snackbar.showSnackbar ({message: message});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
controllerAs:'login'
|
controllerAs: 'login'
|
||||||
};
|
};
|
||||||
|
|
||||||
module.component('vnLogin', COMPONENT);
|
module.component('vnLogin', COMPONENT);
|
||||||
module.config(['$httpProvider', function($httpProvider) {
|
module.config(['$httpProvider', function($httpProvider) {
|
||||||
$httpProvider.defaults.useXDomain = true;
|
$httpProvider.defaults.useXDomain = true;
|
||||||
delete $httpProvider.defaults.headers.common['X-Requested-With'];
|
delete $httpProvider.defaults.headers.common['X-Requested-With'];
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
@ -36,13 +36,13 @@
|
||||||
"raw-loader": "*",
|
"raw-loader": "*",
|
||||||
"sass-loader": "^4.0.2",
|
"sass-loader": "^4.0.2",
|
||||||
"style-loader": "^0.13.1",
|
"style-loader": "^0.13.1",
|
||||||
"webpack": "*",
|
"webpack": "^1.13.3",
|
||||||
"webpack-dev-server": "*"
|
"webpack-dev-server": "^1.16.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack --progress --colors --watch",
|
"build": "webpack --progress --colors --watch",
|
||||||
|
"dev": "webpack-dev-server --progress --colors --hot",
|
||||||
"lint": "eslint ./ --cache --ignore-pattern .gitignore",
|
"lint": "eslint ./ --cache --ignore-pattern .gitignore",
|
||||||
"dev": "webpack-dev-server --progress --colors --inline --hot",
|
|
||||||
"gulp": "gulp",
|
"gulp": "gulp",
|
||||||
"express": "node server.js",
|
"express": "node server.js",
|
||||||
"nginx": "/usr/sbin/nginx -p . -c nginx.conf",
|
"nginx": "/usr/sbin/nginx -p . -c nginx.conf",
|
||||||
|
|
|
@ -11,7 +11,7 @@ module.exports =
|
||||||
path: path.join (__dirname, 'build', 'public'),
|
path: path.join (__dirname, 'build', 'public'),
|
||||||
filename: '[name].js',
|
filename: '[name].js',
|
||||||
publicPath: '/static/',
|
publicPath: '/static/',
|
||||||
chunkFilename: "[name].js"
|
chunkFilename: "chunk.[name].[chunkhash].js"
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
loaders: [
|
loaders: [
|
||||||
|
@ -43,6 +43,10 @@ module.exports =
|
||||||
'node_modules'
|
'node_modules'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
devServer: {
|
||||||
|
inline: true,
|
||||||
|
host: '0.0.0.0'
|
||||||
|
},
|
||||||
devtool: 'eval-source-map'
|
devtool: 'eval-source-map'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
25
myToken.json
25
myToken.json
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
"ids": {
|
|
||||||
"User": 2,
|
|
||||||
"AccessToken": 13
|
|
||||||
},
|
|
||||||
"models": {
|
|
||||||
"User": {
|
|
||||||
"1": "{\"password\":\"$2a$10$Vf2J.QlJo1rkqtTZcTt2M.Crp32SmLbRQWud/pA3h.h4mIaNr978S\",\"email\":\"admin@admin.com\",\"id\":1}"
|
|
||||||
},
|
|
||||||
"AccessToken": {
|
|
||||||
"duWZM0wQ0VqpWXm3GqcCHzkPzQtyHj3TptP9GldSC1ONvJylEx7Lpyxw7lIzQceH": "{\"id\":\"duWZM0wQ0VqpWXm3GqcCHzkPzQtyHj3TptP9GldSC1ONvJylEx7Lpyxw7lIzQceH\",\"ttl\":1209600,\"created\":\"2016-11-08T12:41:47.592Z\",\"userId\":1}",
|
|
||||||
"bxZozWDT6GNyuQKR8vKsrEUYmD8uG3JOLku08DozZO6xEBnZtrRJvYQ78STIpvtj": "{\"id\":\"bxZozWDT6GNyuQKR8vKsrEUYmD8uG3JOLku08DozZO6xEBnZtrRJvYQ78STIpvtj\",\"ttl\":1209600,\"created\":\"2016-11-08T12:42:31.683Z\",\"userId\":1}",
|
|
||||||
"ed9PVgBuNfG9D8QlDpMTZNBK8dKNN4J2XdmKd9gPYAgaShx3eNEcfO2imVsNeBk0": "{\"id\":\"ed9PVgBuNfG9D8QlDpMTZNBK8dKNN4J2XdmKd9gPYAgaShx3eNEcfO2imVsNeBk0\",\"ttl\":1209600,\"created\":\"2016-11-08T12:49:36.866Z\",\"userId\":1}",
|
|
||||||
"ojE0NvYJWRVZt1Z9EKCndZs0jA1mHUx7QFVyTEyzx0HOl0YKCza8orsILBMwdeH5": "{\"id\":\"ojE0NvYJWRVZt1Z9EKCndZs0jA1mHUx7QFVyTEyzx0HOl0YKCza8orsILBMwdeH5\",\"ttl\":1209600,\"created\":\"2016-11-08T12:52:10.061Z\",\"userId\":1}",
|
|
||||||
"lZRSkgCbbyQZYpLnR3gCKAidBXx3E6xucteJ0eDBHsxUUNNazI6DPcP5bq3mXGnS": "{\"id\":\"lZRSkgCbbyQZYpLnR3gCKAidBXx3E6xucteJ0eDBHsxUUNNazI6DPcP5bq3mXGnS\",\"ttl\":1209600,\"created\":\"2016-11-08T12:53:13.238Z\",\"userId\":1}",
|
|
||||||
"Z1VhLSUN0SDctQuRcWKhxru8UiHQfWGG3v0Ascdk2agjbxwiQouJkw49fQ5DKtRZ": "{\"id\":\"Z1VhLSUN0SDctQuRcWKhxru8UiHQfWGG3v0Ascdk2agjbxwiQouJkw49fQ5DKtRZ\",\"ttl\":1209600,\"created\":\"2016-11-08T12:54:36.938Z\",\"userId\":1}",
|
|
||||||
"5JhU0bqFaHRhdbhe0xxFBBt1D1buPX3naGbBgbBPj9yEMbjwrhQ3chFLHFBzA433": "{\"id\":\"5JhU0bqFaHRhdbhe0xxFBBt1D1buPX3naGbBgbBPj9yEMbjwrhQ3chFLHFBzA433\",\"ttl\":1209600,\"created\":\"2016-11-08T12:59:29.548Z\",\"userId\":1}",
|
|
||||||
"x3ZcHQwhgkLZPKJlrGEvrlTIh3le4lbCChEmMbXOzEkGtrb0UKuMxhilgehhaP4H": "{\"id\":\"x3ZcHQwhgkLZPKJlrGEvrlTIh3le4lbCChEmMbXOzEkGtrb0UKuMxhilgehhaP4H\",\"ttl\":1209600,\"created\":\"2016-11-08T13:04:35.169Z\",\"userId\":1}",
|
|
||||||
"cEJfb8uHS5bEjVF3lHjbrFSSl6kbvl71PYyM74FGjoA0aPL2MHkVlf3L2cG8UX4O": "{\"id\":\"cEJfb8uHS5bEjVF3lHjbrFSSl6kbvl71PYyM74FGjoA0aPL2MHkVlf3L2cG8UX4O\",\"ttl\":1209600,\"created\":\"2016-11-08T13:09:40.950Z\",\"userId\":1}",
|
|
||||||
"F5yGEtsyK4XamSRGjqCckISqRYv8RyUfw0cnTthnSrLTD1sZAWsv68vizFAGDLPS": "{\"id\":\"F5yGEtsyK4XamSRGjqCckISqRYv8RyUfw0cnTthnSrLTD1sZAWsv68vizFAGDLPS\",\"ttl\":1209600,\"created\":\"2016-11-08T13:09:57.542Z\",\"userId\":1}",
|
|
||||||
"gk3QKn3Hyg65NE2Brq3lPYxCTaSCFNYrOeny47lrxnw0cFOrXdF5uN3O6WerqXrL": "{\"id\":\"gk3QKn3Hyg65NE2Brq3lPYxCTaSCFNYrOeny47lrxnw0cFOrXdF5uN3O6WerqXrL\",\"ttl\":1209600,\"created\":\"2016-11-08T13:11:06.135Z\",\"userId\":1}",
|
|
||||||
"u5Cvy3hvP6GHnzUs3SaBaSKUvllfB9ZwblgAGC7v3HC2MxCvyhw3jbbrALKiJ4WY": "{\"id\":\"u5Cvy3hvP6GHnzUs3SaBaSKUvllfB9ZwblgAGC7v3HC2MxCvyhw3jbbrALKiJ4WY\",\"ttl\":1209600,\"created\":\"2016-11-09T10:54:05.162Z\",\"userId\":1}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue