Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
944b0459
authored
Sep 26, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fixed error on admin/login
parent
9940ba2b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
5 deletions
sails/Vagrantfile
sails/src/api/controllers/AdminController.js
sails/src/assets/scripts/modules/admin/controllers/login.js
sails/Vagrantfile
View file @
944b0459
...
...
@@ -17,4 +17,6 @@ Vagrant.configure(2) do |config|
config
.
vm
.
provision
"shell"
,
path:
"install.sh"
config
.
vm
.
provision
"shell"
,
path:
"pictoload.sh"
config
.
vm
.
provision
"shell"
,
path:
"bootstrap.sh"
,
run:
"always"
config
.
ssh
.
shell
=
"bash -c 'BASH_ENV=/etc/profile exec bash'"
end
sails/src/api/controllers/AdminController.js
View file @
944b0459
...
...
@@ -23,13 +23,13 @@ module.exports = {
// if found, check password in encrypted form
bcrypt
.
compare
(
password
,
admin
.
password
,
function
(
err
,
match
)
{
if
(
err
)
return
res
.
serverError
(
'Server error'
+
err
);
return
res
.
serverError
(
'Server error'
+
err
);
if
(
!
match
)
// password do not match
return
res
.
unauthorized
(
'Invalid password'
);
return
res
.
unauthorized
(
'Invalid password'
);
// credentials are valid, return token with max life span
var
returned_admin
=
(
JSON
.
parse
(
JSON
.
stringify
(
admin
)));
delete
returned_admin
.
password
;
var
returned_admin
=
(
JSON
.
parse
(
JSON
.
stringify
(
admin
)));
delete
returned_admin
.
password
;
return
res
.
ok
({
token
:
sailsTokenAuth
.
issueToken
({
'isAdmin'
:
true
,
'email'
:
email
},
sails
.
config
.
jwt
.
expiresInMinutes
),
user
:
returned_admin
...
...
sails/src/assets/scripts/modules/admin/controllers/login.js
View file @
944b0459
...
...
@@ -3,7 +3,7 @@
//------------------
// Login Controller
//------------------
dashboardControllers
.
controller
(
'LoginAdminCtrl'
,
function
LoginAdminCtrl
(
$scope
,
$http
,
$window
,
$translate
,
$location
,
config
,
ngToast
)
{
dashboardControllers
.
controller
(
'LoginAdminCtrl'
,
function
LoginAdminCtrl
(
$scope
,
$
rootScope
,
$
http
,
$window
,
$translate
,
$location
,
config
,
ngToast
)
{
// The last parameter, config, is injected from config.js (defined in dashboardConfig module)
$scope
.
credentials
=
{
...
...
@@ -18,6 +18,7 @@ dashboardControllers.controller('LoginAdminCtrl', function LoginAdminCtrl($scope
// Save token, user data in sessionStorage
$window
.
sessionStorage
.
token
=
data
.
token
;
$window
.
sessionStorage
.
user
=
JSON
.
stringify
(
data
.
user
);
$rootScope
.
user
=
data
.
user
;
// Redirect to admin panel
$location
.
path
(
'/admin/licenses'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment