From f452d1155bddc5400d155960f3b88c96ba77b12e Mon Sep 17 00:00:00 2001
From: MonsterDruide1 <5958456@gmail.com>
Date: Sun, 30 Apr 2023 10:09:34 +0200
Subject: [PATCH] Proper login button in header

---
 README.md                                     | 83 +++----------------
 .../layout/navbar-marketing-bootstrap-5.pug   |  4 +-
 .../web/app/views/layout/navbar-marketing.pug |  4 +-
 .../views/layout/navbar-website-redesign.pug  |  4 +-
 4 files changed, 19 insertions(+), 76 deletions(-)

diff --git a/README.md b/README.md
index 05462d8723..43f518abc1 100644
--- a/README.md
+++ b/README.md
@@ -1,76 +1,19 @@
-<h1 align="center">
-  <br>
-  <a href="https://www.overleaf.com"><img src="doc/logo.png" alt="Overleaf" width="300"></a>
-</h1>
+# Overleaf OIDC Edition
 
-<h4 align="center">An open-source online real-time collaborative LaTeX editor.</h4>
+This is a fork of Overleaf that we use on <https://tex.fachschaften.org>. The main change is that we added support for login via OpenID Connect.
 
-<p align="center">
-  <a href="https://github.com/overleaf/overleaf/wiki">Wiki</a> •
-  <a href="https://www.overleaf.com/for/enterprises">Server Pro</a> •
-  <a href="#contributing">Contributing</a> •
-  <a href="https://mailchi.mp/overleaf.com/community-edition-and-server-pro">Mailing List</a> •
-  <a href="#authors">Authors</a> •
-  <a href="#license">License</a>
-</p>
+Note that this currently still has some stuff that's hardcoded for our use, e.g. the log-in page text, and it enables shell-escape.
 
-<img src="doc/screenshot.png" alt="A screenshot of a project being edited in Overleaf Community Edition">
-<p align="center">
-  Figure 1: A screenshot of a project being edited in Overleaf Community Edition.
-</p>
+A mirror of this repo with CI that builds Docker images can be found at <https://gitlab.fachschaften.org/tudo-fsinfo/admin/overleaf>.
 
-## Community Edition
+### Environment Variables
 
-[Overleaf](https://www.overleaf.com) is an open-source online real-time collaborative LaTeX editor. We run a hosted version at [www.overleaf.com](https://www.overleaf.com), but you can also run your own local version, and contribute to the development of Overleaf.
+You need to set the following env vars:
 
-## Enterprise
-
-If you want help installing and maintaining Overleaf in your lab or workplace, we offer an officially supported version called [Overleaf Server Pro](https://www.overleaf.com/for/enterprises). It also includes more features for security (SSO with LDAP or SAML), administration and collaboration (e.g. tracked changes). [Find out more!](https://www.overleaf.com/for/enterprises)
-
-## Keeping up to date
-
-Sign up to the [mailing list](https://mailchi.mp/overleaf.com/community-edition-and-server-pro) to get updates on Overleaf releases and development.
-
-## Installation
-
-We have detailed installation instructions in the [Overleaf Toolkit](https://github.com/overleaf/toolkit/).
-
-## Upgrading
-
-If you are upgrading from a previous version of Overleaf, please see the [Release Notes section on the Wiki](https://github.com/overleaf/overleaf/wiki#release-notes) for all of the versions between your current version and the version you are upgrading to.
-
-## Overleaf Docker Image
-
-This repo contains two dockerfiles, [`Dockerfile-base`](server-ce/Dockerfile-base), which builds the
-`sharelatex/sharelatex-base` image, and [`Dockerfile`](server-ce/Dockerfile) which builds the
-`sharelatex/sharelatex` (or "community") image.
-
-The Base image generally contains the basic dependencies like `wget` and
-`aspell`, plus `texlive`. We split this out because it's a pretty heavy set of
-dependencies, and it's nice to not have to rebuild all of that every time.
-
-The `sharelatex/sharelatex` image extends the base image and adds the actual Overleaf code
-and services.
-
-Use `make build-base` and `make build-community` from `server-ce/` to build these images.
-
-We use the [Phusion base-image](https://github.com/phusion/baseimage-docker)
-(which is extended by our `base` image) to provide us with a VM-like container
-in which to run the Overleaf services. Baseimage uses the `runit` service
-manager to manage services, and we add our init-scripts from the `server-ce/runit`
-folder.
-
-
-## Contributing
-
-Please see the [CONTRIBUTING](CONTRIBUTING.md) file for information on contributing to the development of Overleaf.
-
-## Authors
-
-[The Overleaf Team](https://www.overleaf.com/about)
-
-## License
-
-The code in this repository is released under the GNU AFFERO GENERAL PUBLIC LICENSE, version 3. A copy can be found in the [`LICENSE`](LICENSE) file.
-
-Copyright (c) Overleaf, 2014-2024.
+- `OIDC_ISSUER`: `https://account.example.org/realms/fachschaften.org`
+- `OIDC_AUTHORIZATION_URL`: `https://account.example.org/realms/fachschaften.org/protocol/openid-connect/auth`
+- `OIDC_TOKEN_URL`: `https://account.example.org/realms/fachschaften.org/protocol/openid-connect/token`
+- `OIDC_USERINFO_URL`: `https://account.example.org/realms/fachschaften.org/protocol/openid-connect/userinfo`
+- `OIDC_CALLBACK_URL`: `https://tex.example.org/login/oidc/callback`
+- `OIDC_CLIENT_ID`
+- `OIDC_CLIENT_SECRET`
diff --git a/services/web/app/views/layout/navbar-marketing-bootstrap-5.pug b/services/web/app/views/layout/navbar-marketing-bootstrap-5.pug
index 2c1c9407e4..b5af3328c8 100644
--- a/services/web/app/views/layout/navbar-marketing-bootstrap-5.pug
+++ b/services/web/app/views/layout/navbar-marketing-bootstrap-5.pug
@@ -133,13 +133,13 @@ nav.navbar.navbar-default.navbar-main.navbar-expand-lg
 						// login link
 						+nav-item
 							+nav-link(
-								href="/login"
+								href="/login/oidc"
 								event-tracking="menu-clicked-login"
 								event-tracking-action="clicked"
 								event-tracking-trigger="click"
 								event-tracking-mb="true"
 								event-segmentation={ page: currentUrl }
-							) #{translate('log_in')}
+							) FSorg-Login
 
 					// projects link and account menu
 					if getSessionUser()
diff --git a/services/web/app/views/layout/navbar-marketing.pug b/services/web/app/views/layout/navbar-marketing.pug
index bd8db5bc6c..51354b8262 100644
--- a/services/web/app/views/layout/navbar-marketing.pug
+++ b/services/web/app/views/layout/navbar-marketing.pug
@@ -140,13 +140,13 @@ nav.navbar.navbar-default.navbar-main
 						// login link
 						li
 							a(
-								href="/login"
+								href="/login/oidc"
 								event-tracking="menu-clicked-login"
 								event-tracking-action="clicked"
 								event-tracking-trigger="click"
 								event-tracking-mb="true"
 								event-segmentation={ page: currentUrl }
-							) #{translate('log_in')}
+							) FSorg-Login
 
 					// projects link and account menu
 					if getSessionUser()
diff --git a/services/web/app/views/layout/navbar-website-redesign.pug b/services/web/app/views/layout/navbar-website-redesign.pug
index 82f34991e5..dac0b324dc 100644
--- a/services/web/app/views/layout/navbar-website-redesign.pug
+++ b/services/web/app/views/layout/navbar-website-redesign.pug
@@ -140,13 +140,13 @@ nav.navbar.navbar-default.navbar-main.website-redesign-navbar
 						// login link
 						li.secondary
 							a(
-								href="/login"
+								href="/login/oidc"
 								event-tracking="menu-clicked-login"
 								event-tracking-action="clicked"
 								event-tracking-trigger="click"
 								event-tracking-mb="true"
 								event-segmentation={ page: currentUrl }
-							) #{translate('log_in')}
+							) FSorg-Login
 
 					// projects link and account menu
 					if getSessionUser()
-- 
GitLab