Просмотр исходного кода

Highlight SSO in register/login/home pages (#6396)

* Highlight SSO in register and login pages
* Highlight SSO in home page
* updated split test request to new APIs
* reordered SSO buttons when highlighting SSO in login
* Updated copy for institutional login and fixed indentation
* increased SSO button size in homepage for highlight-sso variant
* prefill email in registration page
* added `register` and `register-success` events

GitOrigin-RevId: 2822afc15c27856ca713002ed804e1f42a2d955c
Miguel Serrano 4 лет назад
Родитель
Сommit
0f7948cfdf

+ 16 - 2
services/web/app/src/Features/StaticPages/HomeController.js

@@ -21,6 +21,9 @@ const fs = require('fs')
 const ErrorController = require('../Errors/ErrorController')
 const SessionManager = require('../Authentication/SessionManager')
 
+const SplitTestHandler = require('../SplitTests/SplitTestHandler')
+const logger = require('@overleaf/logger')
+
 const homepageExists = fs.existsSync(
   Path.join(__dirname, '/../../../views/external/home/v2.pug')
 )
@@ -38,9 +41,20 @@ module.exports = HomeController = {
     }
   },
 
-  home(req, res, next) {
+  async home(req, res) {
     if (Features.hasFeature('homepage') && homepageExists) {
-      return res.render('external/home/v2')
+      try {
+        const highlightSSOAssignment =
+          await SplitTestHandler.promises.getAssignment(req, 'highlight-sso')
+        const highlightSSO = highlightSSOAssignment.variant === 'active'
+        return res.render('external/home/v2', { highlightSSO })
+      } catch (err) {
+        logger.error(
+          { err },
+          "error fetching 'highlight-sso' split test assignment"
+        )
+        return res.render('external/home/v2', { highlightSSO: false })
+      }
     } else {
       return res.redirect('/login')
     }

+ 15 - 0
services/web/frontend/stylesheets/app/homepage.less

@@ -195,6 +195,21 @@
   }
 }
 
+.hp-login-btn-large {
+  .hp-login-btn;
+
+  min-width: 256px;
+  padding-left: 30px;
+  font-size: 20px;
+}
+
+.hp-login-btn-icon-large {
+  .login-btn-icon;
+
+  width: 32px;
+  height: 32px;
+}
+
 .hp-register-form-email-pwd {
   position: relative;
 }

+ 4 - 0
services/web/frontend/stylesheets/app/login-register.less

@@ -155,3 +155,7 @@
 .registration-message-details {
   font-size: 90%;
 }
+
+.registration-block-separator {
+  margin-bottom: 0px;
+}

+ 1 - 0
services/web/locales/en.json

@@ -174,6 +174,7 @@
   "need_to_do_this_to_access_license": "You’ll need to do this in order to have access to the benefits from the <b>__institutionName__</b> site license.",
   "institutional_login_not_supported": "Your university doesn’t support <b>institutional login</b> yet, but you can still register with your institutional email.",
   "institutional_login_unknown": "Sorry, we don’t know which institution issued that email address. You can browse our <a href=\"__link__\">list of institutions</a> to find yours, or you can just register using your email address and password here.",
+  "institutional_login_unknown_sso_highlight_variant": "Sorry, we don’t know which institution issued that email address. You can browse our <a href=\"__link__\">list of institutions</a> to find yours, or you can use one of the other options below.",
   "link_account": "Link Account",
   "link_accounts": "Link Accounts",
   "link_accounts_and_add_email": "Link Accounts and Add Email",