Skip to content

Commit 06b7cd3

Browse files
authored
Merge pull request #12 from flavienbwk/develop
Reversed use of add_argument for api.model
2 parents 3ce6db9 + 27ebd1e commit 06b7cd3

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
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/Dashboard.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Auth } from './utils/Auth'
55
import styled from 'styled-components'
66

77
const Styles = styled.div`
8-
.paddind-bottom {
8+
.padding-bottom {
99
padding-bottom: 16px;
1010
}
1111
@@ -31,7 +31,7 @@ export class Dashboard extends Component {
3131
return (
3232
<Styles>
3333
<Container>
34-
<Row className="paddind-bottom">
34+
<Row className="padding-bottom">
3535
<Col lg={{ span: 12 }} className="center">
3636
<Jumbotron>
3737
<h1>Hello { this.state.profile.first_name } !</h1>

app/app/src/Home.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import styled from 'styled-components';
44
import { Link } from 'react-router-dom';
55

66
const Styles = styled.div`
7-
.paddind-bottom {
7+
.padding-bottom {
88
padding-bottom: 16px;
99
}
1010
@@ -22,7 +22,7 @@ class Home extends Component {
2222
return (
2323
<Styles>
2424
<Container>
25-
<Row className="paddind-bottom">
25+
<Row className="padding-bottom">
2626
<Col lg={{ span: 12 }} className="center">
2727
<Jumbotron>
2828
<h1>Hello</h1>

app/app/src/Login.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Notifier } from './utils/Notifier'
99
import styled from 'styled-components'
1010

1111
const Styles = styled.div`
12-
.paddind-top {
12+
.padding-top {
1313
padding-top: 16px;
1414
}
1515
@@ -84,7 +84,7 @@ export class Login extends Component {
8484
return (
8585
<Styles>
8686
<Container>
87-
<Row className="paddind-top">
87+
<Row className="padding-top">
8888
<Col lg={{ offset: 3, span: 6 }}>
8989
<Card>
9090
<Card.Body>

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)