Browse Source

use csrfToken of appContainer

yusuketk 6 years ago
parent
commit
4a87f06f1c
1 changed files with 4 additions and 7 deletions
  1. 4 7
      src/client/js/components/LoginForm.jsx

+ 4 - 7
src/client/js/components/LoginForm.jsx

@@ -51,7 +51,7 @@ class LoginForm extends React.Component {
   }
   }
 
 
   renderLocalOrLdapLoginForm() {
   renderLocalOrLdapLoginForm() {
-    const { t, csrf } = this.props;
+    const { t, appContainer } = this.props;
 
 
     return (
     return (
       <form role="form" action="/login" method="post">
       <form role="form" action="/login" method="post">
@@ -81,8 +81,7 @@ class LoginForm extends React.Component {
         </div>
         </div>
 
 
         <div className="input-group justify-content-center d-flex mt-5">
         <div className="input-group justify-content-center d-flex mt-5">
-          {/* [TODO][GW-1913] An AppContainer gets csrf data */}
-          <input type="hidden" name="_csrf" value={csrf} />
+          <input type="hidden" name="_csrf" value={appContainer.csrfToken} />
           <button type="submit" id="login" className="btn btn-fill login px-0 py-2">
           <button type="submit" id="login" className="btn btn-fill login px-0 py-2">
             <div className="eff"></div>
             <div className="eff"></div>
             <span className="btn-label p-3">
             <span className="btn-label p-3">
@@ -149,7 +148,7 @@ class LoginForm extends React.Component {
   }
   }
 
 
   renderRegisterForm() {
   renderRegisterForm() {
-    const { t, loginContainer, csrf } = this.props;
+    const { t, appContainer, loginContainer } = this.props;
     return (
     return (
       <div className="back">
       <div className="back">
         {this.registrationMode === 'Restricted' && (
         {this.registrationMode === 'Restricted' && (
@@ -215,8 +214,7 @@ class LoginForm extends React.Component {
           </div>
           </div>
 
 
           <div className="input-group justify-content-center mt-5">
           <div className="input-group justify-content-center mt-5">
-            {/* [TODO][GW-1913] An AppContainer gets csrf data */}
-            <input type="hidden" name="_csrf" value={csrf} />
+            <input type="hidden" name="_csrf" value={appContainer.csrfToken} />
             <button type="submit" className="btn btn-fill px-0 py-2" id="register">
             <button type="submit" className="btn btn-fill px-0 py-2" id="register">
               <div className="eff"></div>
               <div className="eff"></div>
               <span className="btn-label p-3">
               <span className="btn-label p-3">
@@ -293,7 +291,6 @@ LoginForm.propTypes = {
   username: PropTypes.string,
   username: PropTypes.string,
   name: PropTypes.string,
   name: PropTypes.string,
   email: PropTypes.string,
   email: PropTypes.string,
-  csrf: PropTypes.string,
 };
 };
 
 
 export default withTranslation()(LoginFormWrapper);
 export default withTranslation()(LoginFormWrapper);