Skip to content

Commit 9ea2ec0

Browse files
author
flavienbwk
committed
Reversed use of add_argument by api.model
1 parent 3ce6db9 commit 9ea2ec0

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

api/app/controller/auth_controller.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121

2222
api = Namespace('Auth', description='Authentication-related operations')
2323

24-
auth_login_ldap_dto = api.parser()
25-
auth_login_ldap_dto.add_argument('username', type=str, help='LDAP uid', required=True)
26-
auth_login_ldap_dto.add_argument('password', type=str, help='LDAP password', required=True)
24+
auth_login_ldap_dto = api.model('auth_login_ldap', {
25+
'username': fields.String(required=True, description='LDAP uid'),
26+
'password': fields.String(required=True, description='LDAP password')
27+
})
2728

2829
auth_login_ldap_response_dto = api.model('auth_login_ldap_response', {
2930
'error': fields.Boolean(description="True on error, false on success"),

api/app/controller/user_controller.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
)
2828
})
2929

30-
user_profile_update_dto = api.parser()
31-
user_profile_update_dto.add_argument('email', type=str, help='New user email', required=True)
30+
user_profile_update_dto = api.model('user_profile_update', {
31+
'email': fields.String(required=True, description='New user email')
32+
})
33+
3234
user_profile_update_response_dto = api.model('user_profile_update_response', {
3335
'error': fields.Boolean(description="True on error, false on success"),
3436
'message': fields.String(description="Some error or success message"),

app/app/src/utils/Auth.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,7 @@ export class Auth {
136136
checkUserToken = async () => {
137137
let user_authenticated = false
138138
let auth_cookie = this.cookies.get("authentication")
139-
if (auth_cookie
140-
&& "token" in auth_cookie
141-
&& "authenticated" in auth_cookie
142-
&& auth_cookie["authenticated"]) {
139+
if (auth_cookie && "token" in auth_cookie && "authenticated" in auth_cookie && auth_cookie["authenticated"]) {
143140
const api_check = await this.#requestLoginCheck(auth_cookie.token)
144141
if (api_check === undefined || api_check.error) {
145142
Notifier.notifyFromResponse(api_check, "Token check", "Token check failure")

0 commit comments

Comments
 (0)