Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-rest
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-rest
Commits
05da7abe
Commit
05da7abe
authored
Mar 07, 2019
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Added code to create token
parent
a7b50ef9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
auto-login-token.tcl
www/data-source/auto-login-token.tcl
+45
-0
No files found.
www/data-source/auto-login-token.tcl
0 → 100644
View file @
05da7abe
# /packages/sencha-rest/www/login.tcl
#
# Copyright (C
)
2013
]
project-open
[
ad_page_contract
{
Provide the user with cookies and a login token
@author frank.bergmann@project-open.com
@param node Passed by ExtJS to load sub-trees of a tree.
Normally not used, just in case of error.
}
{
{
email
""
}
{
password
""
}
{
expiry_date
""
}
}
if
{
""
==
$password
||
""
==
$email
}
{
doc_return 200
"text/json"
"FAIL - no email or password"
ad_script_abort
}
array
set result_array
[
auth::authenticate
\
-email
$email
\
-password
$password
\
-persistent
\
]
set
account_status
"undefined"
set
user_id 0
if
{[
info
exists result_array
(
account_status
)]}
{
set account_status
$result
_array
(
account_status
)
}
if
{[
info
exists result_array
(
user_id
)]}
{
set user_id
$result
_array
(
user_id
)
}
if
{
"ok"
==
$account
_status && 0 !=
$user
_id
}
{
ad_user_login -forever=0
$user
_id
set token
[
im_generate_auto_login -user_id
$user
_id -expiry_date
$expiry
_date
]
doc_return 200
"text/json"
"{'success': true, 'message': 'success', 'token': '
$token
'}"
ad_script_abort
}
else
{
set auth_message
$result
_array
(
auth_message
)
doc_return 200
"text/json"
"{'success': false, 'message': '
$auth
_message'}"
ad_script_abort
}
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