Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iric-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bioinfo_iric
iric-data
Commits
86e2136d
Commit
86e2136d
authored
4 years ago
by
Jonathan Seguin
Browse files
Options
Downloads
Patches
Plain Diff
check and return error if token auth fails (mixin only)
parent
9e7dace5
No related branches found
Branches containing commit
No related tags found
1 merge request
!68
Resolve "Implement pubkey à la gitlab/github (ou simple token), pour permettre un accès sans fournir son mot de passe"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
portal/views/__init__.py
+5
-1
5 additions, 1 deletion
portal/views/__init__.py
with
5 additions
and
1 deletion
portal/views/__init__.py
+
5
−
1
View file @
86e2136d
...
...
@@ -19,7 +19,11 @@ class TokenLoginMixin(LoginRequiredMixin):
def
dispatch
(
self
,
request
,
*
args
,
**
kwargs
):
if
not
request
.
user
.
is_authenticated
:
user
=
authenticate
(
request
)
login
(
request
,
user
)
if
user
:
login
(
request
,
user
)
else
:
return
JsonResponse
({
'
error
'
:
_
(
'
Malformed authorization header or invalid token
'
)},
status
=
500
)
return
super
().
dispatch
(
request
,
*
args
,
**
kwargs
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment