Browse Source

Adding SSO CAS to Wekan

ppoulard 11 months ago
parent
commit
ee81775dc8

+ 1 - 0
.meteor/packages

@@ -85,3 +85,4 @@ browser-policy
 eluck:accounts-lockout
 rzymek:fullcalendar
 momentjs:[email protected]
+atoy40:accounts-cas


+ 3 - 0
client/components/main/layouts.jade

@@ -17,6 +17,9 @@ template(name="userFormsLayout")
       img(src="{{pathFor '/wekan-logo.png'}}" alt="Wekan")
     section.auth-dialog
       +Template.dynamic(template=content)
+      if isCas
+        .at-form
+          button#cas(class='at-btn submit' type='submit') {{casSignInLabel}}
       div.at-form-lang
         select.select-lang.js-userform-set-language
           each languages

+ 17 - 0
client/components/main/layouts.js

@@ -39,6 +39,16 @@ Template.userFormsLayout.helpers({
     const curLang = T9n.getLanguage() || 'en';
     return t9nTag === curLang;
   },
+
+  isCas() {
+    return Meteor.settings.public &&
+      Meteor.settings.public.cas &&
+      Meteor.settings.public.cas.loginUrl
+  },
+
+  casSignInLabel() {
+    return TAPi18n.__('casSignIn', {}, T9n.getLanguage() || 'en');
+  },
 });
 
 Template.userFormsLayout.events({
@@ -47,6 +57,13 @@ Template.userFormsLayout.events({
     T9n.setLanguage(i18nTagToT9n(i18nTag));
     evt.preventDefault();
   },
+  'click button#cas'() {
+    Meteor.loginWithCas(function() {
+      if (FlowRouter.getRouteName() == 'atSignIn') {
+        FlowRouter.go('/');
+      }
+    });
+  },
 });
 
 Template.defaultLayout.events({

+ 1 - 0
i18n/en.i18n.json

@@ -131,6 +131,7 @@
     "cardMorePopup-title": "More",
     "cards": "Cards",
     "cards-count": "Cards",
+    "casSignIn" : "Sign In with CAS",
     "change": "Change",
     "change-avatar": "Change Avatar",
     "change-password": "Change Password",

+ 1 - 0
settings.json

@@ -0,0 +1 @@
+{}