Browse Source

Merge branch 'develop' of github.com:tracim/tracim_v2 into develop

AlexiCauvin 6 years ago
parent
commit
1341549da5

+ 20 - 20
frontend/src/component/Header/MenuActionListItem/MenuProfil.jsx View File

8
   if (!props.user.logged) return null
8
   if (!props.user.logged) return null
9
 
9
 
10
   return (
10
   return (
11
-      <li className='header__menu__rightside__itemprofil'>
12
-        <div className='profilgroup dropdown'>
13
-          <button className='profilgroup__name btn btn-outline-primary dropdown-toggle' type='button' id='dropdownMenuButton' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>
14
-            <img className='profilgroup__name__imgprofil' src={props.user.avatar_url} />
11
+    <li className='header__menu__rightside__itemprofil'>
12
+      <div className='profilgroup dropdown'>
13
+        <button className='profilgroup__name btn btn-outline-primary dropdown-toggle' type='button' id='dropdownMenuButton' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>
14
+          <img className='profilgroup__name__imgprofil' src={props.user.avatar_url} />
15
 
15
 
16
-            <div className='profilgroup__name__text'>
17
-              {props.user.public_name}
18
-            </div>
19
-          </button>
16
+          <div className='profilgroup__name__text'>
17
+            {props.user.public_name}
18
+          </div>
19
+        </button>
20
 
20
 
21
-          <div className='profilgroup__setting dropdown-menu' aria-labelledby='dropdownMenuButton'>
22
-            <Link className='setting__link dropdown-item' to={PAGE.ACCOUNT}>
23
-              <i className='fa fa-fw fa-user-o mr-2' />
24
-              {props.t('My Account')}
25
-            </Link>
21
+        <div className='profilgroup__setting dropdown-menu' aria-labelledby='dropdownMenuButton'>
22
+          <Link className='setting__link dropdown-item' to={PAGE.ACCOUNT}>
23
+            <i className='fa fa-fw fa-user-o mr-2' />
24
+            {props.t('My Account')}
25
+          </Link>
26
 
26
 
27
-            {/* <div className='setting__link dropdown-item'>Mot de passe</div> */}
28
-            <div className='setting__link dropdown-item' onClick={props.onClickLogout}>
29
-              <i className='fa fa-fw fa-sign-out mr-2' />
30
-              {props.t('Logout')}
31
-            </div>
27
+          {/* <div className='setting__link dropdown-item'>Mot de passe</div> */}
28
+          <div className='setting__link dropdown-item' onClick={props.onClickLogout}>
29
+            <i className='fa fa-fw fa-sign-out mr-2' />
30
+            {props.t('Logout')}
32
           </div>
31
           </div>
33
         </div>
32
         </div>
34
-      </li>
35
-    )
33
+      </div>
34
+    </li>
35
+  )
36
 }
36
 }
37
 export default translate()(MenuProfil)
37
 export default translate()(MenuProfil)
38
 
38
 

+ 28 - 20
frontend/src/container/Login.jsx View File

17
   setUserConnected
17
   setUserConnected
18
 } from '../action-creator.sync.js'
18
 } from '../action-creator.sync.js'
19
 import { COOKIE, PAGE } from '../helper.js'
19
 import { COOKIE, PAGE } from '../helper.js'
20
+import { Checkbox } from 'tracim_frontend_lib'
20
 
21
 
21
 class Login extends React.Component {
22
 class Login extends React.Component {
22
   constructor (props) {
23
   constructor (props) {
36
 
37
 
37
   handleChangeLogin = e => this.setState({inputLogin: {...this.state.inputLogin, value: e.target.value}})
38
   handleChangeLogin = e => this.setState({inputLogin: {...this.state.inputLogin, value: e.target.value}})
38
   handleChangePassword = e => this.setState({inputPassword: {...this.state.inputPassword, value: e.target.value}})
39
   handleChangePassword = e => this.setState({inputPassword: {...this.state.inputPassword, value: e.target.value}})
39
-  handleChangeRememberMe = () => this.setState(prev => ({inputRememberMe: !prev.inputRememberMe}))
40
+  handleChangeRememberMe = e => {
41
+    e.preventDefault()
42
+    e.stopPropagation()
43
+    this.setState(prev => ({inputRememberMe: !prev.inputRememberMe}))
44
+  }
40
 
45
 
41
   handleClickSubmit = async () => {
46
   handleClickSubmit = async () => {
42
     const { history, dispatch, t } = this.props
47
     const { history, dispatch, t } = this.props
52
         logged: true
57
         logged: true
53
       }))
58
       }))
54
 
59
 
55
-      Cookies.set(COOKIE.USER_LOGIN, inputLogin.value)
56
-      Cookies.set(COOKIE.USER_AUTH, userAuth)
60
+      if (inputRememberMe) {
61
+        Cookies.set(COOKIE.USER_LOGIN, inputLogin.value, {expires: 365})
62
+        Cookies.set(COOKIE.USER_AUTH, userAuth, {expires: 365})
63
+      } else {
64
+        Cookies.set(COOKIE.USER_LOGIN, inputLogin.value)
65
+        Cookies.set(COOKIE.USER_AUTH, userAuth)
66
+      }
57
 
67
 
58
       history.push(PAGE.WORKSPACE.ROOT)
68
       history.push(PAGE.WORKSPACE.ROOT)
59
     } else if (fetchPostUserLogin.status === 403) {
69
     } else if (fetchPostUserLogin.status === 403) {
103
                       />
113
                       />
104
 
114
 
105
                       <div className='row align-items-center mt-4 mb-4'>
115
                       <div className='row align-items-center mt-4 mb-4'>
106
-
107
-                        {/*
108
-                          <div className='col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6'>
109
-                            <InputCheckbox
110
-                              parentClassName='connection__form__rememberme'
111
-                              customClass=''
112
-                              label='Se souvenir de moi'
116
+                        <div className='col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6'>
117
+                          <div className='connection__form__rememberme' onClick={this.handleChangeRememberMe}>
118
+                            <Checkbox
119
+                              name='inputRememberMe'
113
                               checked={this.state.inputRememberMe}
120
                               checked={this.state.inputRememberMe}
114
-                              onChange={this.handleChangeRememberMe}
115
                             />
121
                             />
122
+                            Se souvenir de moi
116
                           </div>
123
                           </div>
117
-                        */}
118
 
124
 
119
-                        <div className='col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6'>
120
                           <LoginBtnForgotPw
125
                           <LoginBtnForgotPw
121
                             customClass='connection__form__pwforgot'
126
                             customClass='connection__form__pwforgot'
122
                             label={this.props.t('Forgotten password ?')}
127
                             label={this.props.t('Forgotten password ?')}
123
                           />
128
                           />
124
                         </div>
129
                         </div>
125
-                        <Button
126
-                          htmlType='button'
127
-                          bootstrapType='primary'
128
-                          customClass='connection__form__btnsubmit ml-auto'
129
-                          label={this.props.t('Connection')}
130
-                          onClick={this.handleClickSubmit}
131
-                        />
130
+
131
+                        <div className='col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6'>
132
+                          <Button
133
+                            htmlType='button'
134
+                            bootstrapType='primary'
135
+                            customClass='connection__form__btnsubmit ml-auto'
136
+                            label={this.props.t('Connection')}
137
+                            onClick={this.handleClickSubmit}
138
+                          />
139
+                        </div>
132
                       </div>
140
                       </div>
133
                     </div>
141
                     </div>
134
 
142
 

+ 7 - 10
frontend/src/css/Login.styl View File

20
       font-size 25px
20
       font-size 25px
21
   .connection__form
21
   .connection__form
22
     &__rememberme
22
     &__rememberme
23
-      &__label
24
-        font-size 13px
23
+      margin-bottom 10px
24
+      font-size 14px
25
+      line-height 23px
26
+      cursor pointer
27
+      label
28
+        margin-right 8px
29
+        top 4px
25
     &__groupemail
30
     &__groupemail
26
       position relative
31
       position relative
27
       &__icon
32
       &__icon
55
     &__pwforgot
60
     &__pwforgot
56
       cursor pointer
61
       cursor pointer
57
       font-size 13px
62
       font-size 13px
58
-      &:hover::after
59
-        position absolute
60
-        top 20px
61
-        left 15px
62
-        border-bottom 1px solid darkGrey
63
-        padding-bottom 2px
64
-        content ' '
65
-        width 130px
66
   &__footer
63
   &__footer
67
     position fixed
64
     position fixed
68
     bottom 2%
65
     bottom 2%

+ 0 - 2
frontend_lib/src/component/Input/Checkbox.jsx View File

59
 }
59
 }
60
 
60
 
61
 Checkbox.defaultProps = {
61
 Checkbox.defaultProps = {
62
-  name: '',
63
-  onClickCheckbox: () => {},
64
   checked: false,
62
   checked: false,
65
   disabled: false
63
   disabled: false
66
 }
64
 }

+ 1 - 1
frontend_lib/src/component/Timeline/Timeline.jsx View File

189
   isArchived: PropTypes.bool,
189
   isArchived: PropTypes.bool,
190
   onClickRestoreArchived: PropTypes.func,
190
   onClickRestoreArchived: PropTypes.func,
191
   isDeleted: PropTypes.bool,
191
   isDeleted: PropTypes.bool,
192
-  onClickRestoreDeleted: PropTypes.func,
192
+  onClickRestoreDeleted: PropTypes.func
193
 }
193
 }
194
 
194
 
195
 Timeline.defaultProps = {
195
 Timeline.defaultProps = {