ソースを参照

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

AlexiCauvin 6 年 前
コミット
1341549da5

+ 20 - 20
frontend/src/component/Header/MenuActionListItem/MenuProfil.jsx ファイルの表示

@@ -8,31 +8,31 @@ const MenuProfil = props => {
8 8
   if (!props.user.logged) return null
9 9
 
10 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 31
           </div>
33 32
         </div>
34
-      </li>
35
-    )
33
+      </div>
34
+    </li>
35
+  )
36 36
 }
37 37
 export default translate()(MenuProfil)
38 38
 

+ 28 - 20
frontend/src/container/Login.jsx ファイルの表示

@@ -17,6 +17,7 @@ import {
17 17
   setUserConnected
18 18
 } from '../action-creator.sync.js'
19 19
 import { COOKIE, PAGE } from '../helper.js'
20
+import { Checkbox } from 'tracim_frontend_lib'
20 21
 
21 22
 class Login extends React.Component {
22 23
   constructor (props) {
@@ -36,7 +37,11 @@ class Login extends React.Component {
36 37
 
37 38
   handleChangeLogin = e => this.setState({inputLogin: {...this.state.inputLogin, value: e.target.value}})
38 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 46
   handleClickSubmit = async () => {
42 47
     const { history, dispatch, t } = this.props
@@ -52,8 +57,13 @@ class Login extends React.Component {
52 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 68
       history.push(PAGE.WORKSPACE.ROOT)
59 69
     } else if (fetchPostUserLogin.status === 403) {
@@ -103,32 +113,30 @@ class Login extends React.Component {
103 113
                       />
104 114
 
105 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 120
                               checked={this.state.inputRememberMe}
114
-                              onChange={this.handleChangeRememberMe}
115 121
                             />
122
+                            Se souvenir de moi
116 123
                           </div>
117
-                        */}
118 124
 
119
-                        <div className='col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6'>
120 125
                           <LoginBtnForgotPw
121 126
                             customClass='connection__form__pwforgot'
122 127
                             label={this.props.t('Forgotten password ?')}
123 128
                           />
124 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 140
                       </div>
133 141
                     </div>
134 142
 

+ 7 - 10
frontend/src/css/Login.styl ファイルの表示

@@ -20,8 +20,13 @@
20 20
       font-size 25px
21 21
   .connection__form
22 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 30
     &__groupemail
26 31
       position relative
27 32
       &__icon
@@ -55,14 +60,6 @@
55 60
     &__pwforgot
56 61
       cursor pointer
57 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 63
   &__footer
67 64
     position fixed
68 65
     bottom 2%

+ 0 - 2
frontend_lib/src/component/Input/Checkbox.jsx ファイルの表示

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

+ 1 - 1
frontend_lib/src/component/Timeline/Timeline.jsx ファイルの表示

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