Browse Source

Loading authentication page

guillaume 6 years ago
parent
commit
8b3601248d

+ 24 - 13
client/components/main/layouts.jade

@@ -13,20 +13,20 @@ head
 
 
 template(name="userFormsLayout")
 template(name="userFormsLayout")
   section.auth-layout
   section.auth-layout
-    h1
-      br
-      br
     section.auth-dialog
     section.auth-dialog
-      +Template.dynamic(template=content)
-      if currentSetting.displayAuthenticationMethod
-        +connectionMethod(authenticationMethod=currentSetting.defaultAuthenticationMethod)
-      div.at-form-lang
-        select.select-lang.js-userform-set-language
-          each languages
-            if isCurrentLanguage
-              option(value="{{tag}}" selected="selected") {{name}}
-            else
-              option(value="{{tag}}") {{name}}
+      if isLoading
+        +loader
+      else
+        +Template.dynamic(template=content)
+        if currentSetting.displayAuthenticationMethod
+          +connectionMethod(authenticationMethod=currentSetting.defaultAuthenticationMethod)
+        div.at-form-lang
+          select.select-lang.js-userform-set-language
+            each languages
+              if isCurrentLanguage
+                option(value="{{tag}}" selected="selected") {{name}}
+              else
+                option(value="{{tag}}") {{name}}
 
 
 template(name="defaultLayout")
 template(name="defaultLayout")
   +header
   +header
@@ -59,3 +59,14 @@ template(name="message")
     unless currentUser
     unless currentUser
       with(pathFor route='atSignIn')
       with(pathFor route='atSignIn')
         p {{{_ 'page-maybe-private' this}}}
         p {{{_ 'page-maybe-private' this}}}
+
+template(name="loader")
+  h1.loadingText {{_ 'loading'}}
+  .lds-roller
+    div
+    div
+    div
+    div
+    div
+    div
+    div

+ 19 - 8
client/components/main/layouts.js

@@ -23,6 +23,7 @@ const validator = {
 Template.userFormsLayout.onCreated(function() {
 Template.userFormsLayout.onCreated(function() {
   const instance = this;
   const instance = this;
   instance.currentSetting = new ReactiveVar();
   instance.currentSetting = new ReactiveVar();
+  instance.isLoading = new ReactiveVar(false);
 
 
   Meteor.subscribe('setting', {
   Meteor.subscribe('setting', {
     onReady() {
     onReady() {
@@ -47,6 +48,10 @@ Template.userFormsLayout.helpers({
     return Template.instance().currentSetting.get();
     return Template.instance().currentSetting.get();
   },
   },
 
 
+  isLoading() {
+    return Template.instance().isLoading.get();
+  },
+
   afterBodyStart() {
   afterBodyStart() {
     return currentSetting.customHTMLafterBodyStart;
     return currentSetting.customHTMLafterBodyStart;
   },
   },
@@ -89,7 +94,11 @@ Template.userFormsLayout.events({
   },
   },
   'click #at-btn'(event, instance) {
   'click #at-btn'(event, instance) {
     if (FlowRouter.getRouteName() === 'atSignIn') {
     if (FlowRouter.getRouteName() === 'atSignIn') {
-      authentication(event, instance);
+      instance.isLoading.set(true);
+      authentication(event, instance)
+        .then(() => {
+          instance.isLoading.set(false);
+        });
     }
     }
   },
   },
 });
 });
@@ -116,19 +125,21 @@ async function authentication(event, instance) {
 
 
   switch (result) {
   switch (result) {
   case 'ldap':
   case 'ldap':
-    Meteor.loginWithLDAP(match, password, function() {
-      FlowRouter.go('/');
+    return new Promise((resolve) => {
+      Meteor.loginWithLDAP(match, password, function() {
+        resolve(FlowRouter.go('/'));
+      });
     });
     });
-    break;
 
 
   case 'cas':
   case 'cas':
-    Meteor.loginWithCas(function() {
-      FlowRouter.go('/');
+    return new Promise((resolve) => {
+      Meteor.loginWithCas(match, password, function() {
+        resolve(FlowRouter.go('/'));
+      });
     });
     });
-    break;
 
 
   default:
   default:
-    break;
+    return;
   }
   }
 }
 }
 
 

+ 102 - 2
client/components/main/layouts.styl

@@ -61,7 +61,7 @@ body
       display: block
       display: block
       float: right
       float: right
       font-size: 24px
       font-size: 24px
-  
+
   .modal-content-wide
   .modal-content-wide
     width: 800px
     width: 800px
     min-height: 0px
     min-height: 0px
@@ -290,7 +290,7 @@ kbd
 // Implement a thiner close icon as suggested in
 // Implement a thiner close icon as suggested in
 // https://github.com/FortAwesome/Font-Awesome/issues/1540#issuecomment-68689950
 // https://github.com/FortAwesome/Font-Awesome/issues/1540#issuecomment-68689950
 .fa.fa-times-thin:before
 .fa.fa-times-thin:before
-  content: '\00d7';
+  content: '\00d7'
 
 
 .fa.fa-globe.colorful, .fa.fa-bell.colorful
 .fa.fa-globe.colorful, .fa.fa-bell.colorful
   color: #4caf50
   color: #4caf50
@@ -399,3 +399,103 @@ a
   height: 37px
   height: 37px
   margin: 8px 10px 0 0
   margin: 8px 10px 0 0
   width: 50px
   width: 50px
+
+.select-authentication
+  width: 100%
+
+.auth-layout
+  display: flex
+  flex-direction: column
+  align-items: center
+  justify-content: center
+  height: 100%
+
+  .auth-dialog
+    margin: 0 !important
+
+.loadingText
+  text-align: center
+
+.lds-roller
+  display: block
+  margin: auto
+  position: relative
+  width: 64px
+  height: 64px
+
+  div
+    animation: lds-roller 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite
+    transform-origin: 32px 32px
+
+  div:after
+    content: " "
+    display: block
+    position: absolute
+    width: 6px
+    height: 6px
+    border-radius: 50%
+    background: #dedede
+    margin: -3px 0 0 -3px
+
+  div:nth-child(1)
+    animation-delay: -0.036s
+
+  div:nth-child(1):after
+    top: 50px
+    left: 50px
+
+  div:nth-child(2)
+    animation-delay: -0.072s
+
+  div:nth-child(2):after
+    top: 54px
+    left: 45px
+
+  div:nth-child(3)
+    animation-delay: -0.108s
+
+  div:nth-child(3):after
+    top: 57px
+    left: 39px
+
+  div:nth-child(4)
+    animation-delay: -0.144s
+
+  div:nth-child(4):after
+    top: 58px
+    left: 32px
+
+  div:nth-child(5)
+    animation-delay: -0.18s
+
+  div:nth-child(5):after
+    top: 57px
+    left: 25px
+
+  div:nth-child(6)
+    animation-delay: -0.216s
+
+  div:nth-child(6):after
+    top: 54px
+    left: 19px
+
+  div:nth-child(7)
+    animation-delay: -0.252s
+
+  div:nth-child(7):after
+    top: 50px
+    left: 14px
+
+  div:nth-child(8)
+    animation-delay: -0.288s
+
+  div:nth-child(8):after
+    top: 45px
+    left: 10px
+
+@keyframes lds-roller
+  0%
+    transform: rotate(0deg)
+
+  100%
+    transform: rotate(360deg)

+ 2 - 1
i18n/en.i18n.json

@@ -691,5 +691,6 @@
     "swimlaneDeletePopup-title": "Delete Swimlane ?",
     "swimlaneDeletePopup-title": "Delete Swimlane ?",
     "swimlane-delete-pop": "All actions will be removed from the activity feed and you won't be able to recover the swimlane. There is no undo.",
     "swimlane-delete-pop": "All actions will be removed from the activity feed and you won't be able to recover the swimlane. There is no undo.",
     "restore-all": "Restore all",
     "restore-all": "Restore all",
-    "delete-all": "Delete all"
+    "delete-all": "Delete all",
+    "loading": "Loading, please wait."
 }
 }

+ 3 - 2
i18n/fr.i18n.json

@@ -688,5 +688,6 @@
     "swimlaneDeletePopup-title": "Supprimer le couloir ?",
     "swimlaneDeletePopup-title": "Supprimer le couloir ?",
     "swimlane-delete-pop": "Toutes les actions vont être supprimées du suivi d'activités et vous ne pourrez plus utiliser ce couloir. Cette action est irréversible.",
     "swimlane-delete-pop": "Toutes les actions vont être supprimées du suivi d'activités et vous ne pourrez plus utiliser ce couloir. Cette action est irréversible.",
     "restore-all": "Tout supprimer",
     "restore-all": "Tout supprimer",
-    "delete-all": "Tout restaurer"
-}
+    "delete-all": "Tout restaurer",
+    "loading": "Chargement, merci de patienter."
+}