Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Project Allocator
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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
edtech
Project Allocator
Commits
a544853f
Commit
a544853f
authored
2 years ago
by
Ivan Procaccini
Browse files
Options
Downloads
Patches
Plain Diff
Refactor: Rename User to AuthenticatedUser
parent
89061990
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/models/__init__.py
+1
-0
1 addition, 0 deletions
app/models/__init__.py
app/models/administration.py
+1
-1
1 addition, 1 deletion
app/models/administration.py
app/views/auth.py
+5
-5
5 additions, 5 deletions
app/views/auth.py
with
7 additions
and
6 deletions
app/models/__init__.py
+
1
−
0
View file @
a544853f
from
.administration
import
*
from
.project
import
*
This diff is collapsed.
Click to expand it.
app/models/administration.py
+
1
−
1
View file @
a544853f
from
..database
import
db
class
User
(
db
.
Model
):
class
Authenticated
User
(
db
.
Model
):
username
=
db
.
Column
(
db
.
String
(
10
),
primary_key
=
True
)
firstname
=
db
.
Column
(
db
.
String
)
surname
=
db
.
Column
(
db
.
String
)
...
...
This diff is collapsed.
Click to expand it.
app/views/auth.py
+
5
−
5
View file @
a544853f
...
...
@@ -9,7 +9,7 @@ from .. import messages, login_manager, ldap_service
from
..database
import
db
from
..forms
import
LoginForm
from
..ldap_authentication.authenticator
import
NAME
,
SURNAME
from
..models
import
User
from
..models
import
Authenticated
User
bp
=
Blueprint
(
"
auth
"
,
__name__
)
...
...
@@ -21,7 +21,7 @@ def get_current_user():
@login_manager.user_loader
def
load_user
(
user_id
):
return
User
.
query
.
get
(
user_id
)
return
Authenticated
User
.
query
.
get
(
user_id
)
@bp.route
(
"
/login
"
,
methods
=
(
"
GET
"
,
"
POST
"
))
...
...
@@ -44,9 +44,9 @@ def login():
if
attributes
is
None
:
flash
(
messages
.
LOGIN_UNSUCCESSFUL_ERROR
)
return
render_template
(
"
pages/login.html
"
,
form
=
form
)
user
=
User
.
query
.
filter_by
(
username
=
username
).
first
()
user
=
Authenticated
User
.
query
.
filter_by
(
username
=
username
).
first
()
if
not
user
:
user
=
User
(
user
=
Authenticated
User
(
username
=
username
,
firstname
=
attributes
.
get
(
NAME
,
username
.
upper
()),
surname
=
attributes
.
get
(
SURNAME
,
""
),
...
...
@@ -66,7 +66,7 @@ def login():
@bp.route
(
"
/logout
"
)
def
logout
():
if
not
current_user
.
is_anonymous
:
db
.
session
.
delete
(
User
.
query
.
get
(
current_user
.
username
))
db
.
session
.
delete
(
Authenticated
User
.
query
.
get
(
current_user
.
username
))
db
.
session
.
commit
()
logout_user
()
return
redirect
(
url_for
(
"
auth.login
"
))
...
...
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