Fix origin and add email login note to login page

This commit is contained in:
Rogerio Chaves 2020-04-16 22:16:23 +02:00
parent 4ed2d68d17
commit 52a329135e
No known key found for this signature in database
GPG Key ID: E6AF5440509B1D94
4 changed files with 13 additions and 3 deletions

View File

@ -223,9 +223,10 @@ router.get("/keys", (req, res) => {
router.post("/keys/email", async (req, res) => {
const email = req.body.email;
const origin = req.body.origin;
let html = await ejs.renderFile("views/email_sign_in.ejs", {
host: `http://${req.headers.host}`,
origin,
ssb_key: req.cookies["ssb_key"],
});

View File

@ -1,7 +1,7 @@
<div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; line-height: 1.3em; font-size: 16px; padding: 30px 0">
<h1 style="font-weight: bold; line-height: 1.3em; margin: 0; padding: 10px 0 0 0; font-weight: 200;">Login button</h1>
<p>Welcome to Social, please use the button below to login to your account:</p>
<form action="<%= host %>/login" method="POST" style="padding: 20px 0">
<form action="<%= origin %>/login" method="POST" style="padding: 20px 0">
<input type="hidden" name="ssb_key" value="<%= ssb_key %>" />
<input type="submit" value="Login to Social" style="background: #08d; color: #fff; border-radius: 3px; padding: 8px 10px; border: none; cursor: pointer; text-decoration: none; display: inline-block; padding: 16px 20px; font-size: 18px;">
</form>

View File

@ -16,8 +16,13 @@
<form action="/keys/email" method="POST">
<div style="padding: 20px 0 30px 0">
<label>
<input type="hidden" name="origin" id="origin" />
<script>
const origin = document.querySelector("#origin");
origin.value = window.location.origin;
</script>
Email: <br />
<input type="email" name="email">
<input type="email" name="email" />
</label>
</div>
<input class="button-big" type="submit" value="Send">

View File

@ -3,6 +3,10 @@
<div style="max-width: 800px; margin: 0 auto">
<h1 style="padding-top: 50px">Login</h1>
<p style="padding-top: 15px">
You should probably have received your login button by email, search for "Social login button", if not, then you must have saved your key, you can input it here
</p>
<form method="POST" action="/login" enctype="multipart/form-data">
<div style="padding: 20px 0 10px 0">
<label>