You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2020/10/16 18:27:00 UTC

[sling-org-apache-sling-app-cms] 03/06: Adding a custom login fragment

This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit 8d7f6fea5de14b7f4b551daf4564cd8325dfccb2
Author: Dan Klco <dk...@apache.org>
AuthorDate: Fri Oct 16 14:22:02 2020 -0400

    Adding a custom login fragment
---
 feature/src/main/features/app/cms.json             |   4 +
 login/bnd.bnd                                      |   1 +
 login/pom.xml                                      |  33 +++++
 .../apache/sling/auth/form/impl/package-info.java  |  26 ++++
 .../apache/sling/auth/form/impl/custom_login.html  | 142 +++++++++++++++++++++
 pom.xml                                            |   1 +
 6 files changed, 207 insertions(+)

diff --git a/feature/src/main/features/app/cms.json b/feature/src/main/features/app/cms.json
index 75269de..407e5b2 100644
--- a/feature/src/main/features/app/cms.json
+++ b/feature/src/main/features/app/cms.json
@@ -99,6 +99,10 @@
             "start-order":"20"
         },
         {
+            "id":"org.apache.sling:org.apache.sling.cms.login:${cms.version}",
+            "start-order":"20"
+        },
+        {
             "id":"org.apache.sling:org.apache.sling.commons.crypto:1.0.0",
             "start-order":"15"
         },
diff --git a/login/bnd.bnd b/login/bnd.bnd
new file mode 100644
index 0000000..f2d9b5c
--- /dev/null
+++ b/login/bnd.bnd
@@ -0,0 +1 @@
+Fragment-Host: org.apache.sling.auth.form
\ No newline at end of file
diff --git a/login/pom.xml b/login/pom.xml
new file mode 100644
index 0000000..c639607
--- /dev/null
+++ b/login/pom.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
+the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in
+writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the
+License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>org.apache.sling.cms</artifactId>
+        <groupId>org.apache.sling</groupId>
+        <version>0.16.3-SNAPSHOT</version>
+    </parent>
+    <artifactId>org.apache.sling.cms.login</artifactId>
+    <name>Apache Sling - Login Fragment</name>
+    <description>Provides a custom login window for Sling CMS</description>
+    <properties>
+        <bnd.baseline.skip>true</bnd.baseline.skip>
+    </properties>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>biz.aQute.bnd</groupId>
+                <artifactId>bnd-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi.annotation</artifactId>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/login/src/main/java/org/apache/sling/auth/form/impl/package-info.java b/login/src/main/java/org/apache/sling/auth/form/impl/package-info.java
new file mode 100644
index 0000000..8ec1c70
--- /dev/null
+++ b/login/src/main/java/org/apache/sling/auth/form/impl/package-info.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Expose the package for the login form
+ */
+@Version("1.0.0")
+package org.apache.sling.auth.form.impl;
+
+import org.osgi.annotation.versioning.Version;
diff --git a/login/src/main/resources/org/apache/sling/auth/form/impl/custom_login.html b/login/src/main/resources/org/apache/sling/auth/form/impl/custom_login.html
new file mode 100644
index 0000000..c34d76e
--- /dev/null
+++ b/login/src/main/resources/org/apache/sling/auth/form/impl/custom_login.html
@@ -0,0 +1,142 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+   http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8" />
+    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+    <title>Login :: Apache Sling CMS</title>
+    <link
+      href="/static/clientlibs/sling-cms/css/styles.min.css"
+      rel="stylesheet"
+    />
+    <link
+      rel="apple-touch-icon"
+      sizes="180x180"
+      href="/static/clientlibs/sling-cms/img/apple-touch-icon.png"
+    />
+    <link
+      rel="icon"
+      type="image/png"
+      sizes="32x32"
+      href="/static/clientlibs/sling-cms/img/favicon-32x32.png"
+    />
+    <link
+      rel="icon"
+      type="image/png"
+      sizes="16x16"
+      href="/static/clientlibs/sling-cms/img/favicon-16x16.png"
+    />
+    <link
+      rel="shortcut icon"
+      href="/static/clientlibs/sling-cms/img/favicon.ico"
+    />
+    <meta name="apple-mobile-web-app-title" content="Apache Sling CMS" />
+    <meta name="application-name" content="Apache Sling CMS" />
+    <link
+      rel="mask-icon"
+      href="/static/clientlibs/sling-cms/img/safari-pinned-tab.svg"
+      color="#662f8f"
+    />
+    <meta name="msapplication-TileColor" content="#662f8f" />
+    <meta name="theme-color" content="#662f8f" />
+    <meta
+      name="msapplication-config"
+      content="/static/clientlibs/sling-cms/img/browserconfig.xml"
+    />
+    <link
+      rel="manifest"
+      href="/static/clientlibs/sling-cms/img/site.webmanifest"
+    />
+  </head>
+
+  <body class="cms has-background-light">
+    <div class="gradient"></div>
+    <div class="container is-fluid">
+      <div class="columns is-centered is-vcentered" style="min-height: calc(100vh)">
+        <div class="column is-two-thirds-tablet is-half-desktop is-one-third-widescreen">
+          <div class="box mt-6">
+            <div class="columns">
+              <div class="column">
+                <a class="" href="http://sling.apache.org">
+                  <img src="/static/clientlibs/sling-cms/img/sling-logo.svg" width="100" alt="Apache Sling CMS">
+                </a>
+                <h1 class="pt-3 is-size-4">Welcome to Apache Sling CMS</h1>
+                <p>
+                  Sling CMS is a fully-featured Content Management System built
+                  with
+                  <a
+                    href="https://sling.apache.org"
+                    target="_blank"
+                    rel="noopener noreferrer"
+                    >Apache Sling</a
+                  >.
+                </p>
+              </div>
+              <div class="column">
+                <h3>Login</h3>
+                <p class="has-text-danger">${j_reason}</p>
+                <form method="POST" action="/j_security_check" class="py-3">
+                  <input type="hidden" name="_charset_" value="UTF-8" />
+                  <input type="hidden" name="resource" value="${resource}" />
+                  <div class="field">
+                    <label class="label is-sr-only" for="j_username"
+                      >Username</label
+                    >
+                    <div class="control">
+                      <input
+                        class="input"
+                        name="j_username"
+                        type="text"
+                        placeholder="Username"
+                        required="required"
+                      />
+                    </div>
+                  </div>
+                  <div class="field">
+                    <label class="label is-sr-only" for="j_password"
+                      >Password</label
+                    >
+                    <div class="control">
+                      <input
+                        class="input"
+                        name="j_password"
+                        type="password"
+                        placeholder="Password"
+                        required="required"
+                      />
+                    </div>
+                  </div>
+                  <div class="field">
+                    <button id="login" class="button is-primary" type="submit">
+                      Login
+                    </button>
+                  </div>
+                </form>
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+    <script
+      src="/static/clientlibs/sling-cms/js/scripts-all.min.js"
+      async
+    ></script>
+  </body>
+</html>
diff --git a/pom.xml b/pom.xml
index 6e9fc8f..0969957 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,6 +36,7 @@
         <module>api</module>
         <module>core</module>
         <module>transformer</module>
+        <module>login</module>
         <module>ui</module>
         <module>reference</module>
         <module>feature</module>