Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
409 additions
and
503 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import type { Template, TemplateEngine } from './TemplateEngine'; | ||
import Dict = NodeJS.Dict; | ||
|
||
/** | ||
* Calls the given array of {@link TemplateEngine}s in the order they appear, | ||
* feeding the output of one into the input of the next. | ||
* | ||
* The first engine will be called with the provided contents and template parameters. | ||
* All subsequent engines will be called with no template parameter. | ||
* Contents will still be passed along and another entry will be added for the body of the previous output. | ||
*/ | ||
export class ChainedTemplateEngine<T extends Dict<any> = Dict<any>> implements TemplateEngine<T> { | ||
private readonly firstEngine: TemplateEngine<T>; | ||
private readonly chainedEngines: TemplateEngine[]; | ||
private readonly renderedName: string; | ||
|
||
/** | ||
* @param engines - Engines will be executed in the same order as the array. | ||
* @param renderedName - The name of the key used to pass the body of one engine to the next. | ||
*/ | ||
public constructor(engines: TemplateEngine[], renderedName = 'body') { | ||
if (engines.length === 0) { | ||
throw new Error('At least 1 engine needs to be provided.'); | ||
} | ||
this.firstEngine = engines[0]; | ||
this.chainedEngines = engines.slice(1); | ||
this.renderedName = renderedName; | ||
} | ||
|
||
public async render(contents: T): Promise<string>; | ||
public async render<TCustom = T>(contents: TCustom, template: Template): Promise<string>; | ||
public async render<TCustom = T>(contents: TCustom, template?: Template): Promise<string> { | ||
let body = await this.firstEngine.render(contents, template!); | ||
for (const engine of this.chainedEngines) { | ||
body = await engine.render({ ...contents, [this.renderedName]: body }); | ||
} | ||
return body; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,4 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
<title>Authorize</title> | ||
<link rel="stylesheet" href="/.well_known/css/styles/main.css" type="text/css"> | ||
</head> | ||
<body> | ||
<header> | ||
<a href="/"><img src="/.well_known/css/images/solid.svg" alt="[Solid logo]" /></a> | ||
<h1>Community Solid Server</h1> | ||
</header> | ||
<main> | ||
<h1>Authorize</h1> | ||
<form action="/idp/confirm" method="post"> | ||
<p class="actions"><button autofocus type="submit" name="submit" class="ids-link-filled">Continue</button></p> | ||
</form> | ||
</main> | ||
<footer> | ||
<p> | ||
©2019–2021 <a href="https://inrupt.com/">Inrupt Inc.</a> | ||
and <a href="https://www.imec-int.com/">imec</a> | ||
</p> | ||
</footer> | ||
</body> | ||
</html> | ||
<h1>Authorize</h1> | ||
<form action="/idp/confirm" method="post"> | ||
<p class="actions"><button autofocus type="submit" name="submit" class="ids-link-filled">Continue</button></p> | ||
</form> |
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
templates/identity/email-password/forgot-password-response.html.ejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<h1>Email sent</h1> | ||
<form action="/idp/forgotpassword" method="post"> | ||
<p>If your account exists, an email has been sent with a link to reset your password.</p> | ||
<p>If you do not receive your email in a couple of minutes, check your spam folder or click the link below to send another email.</p> | ||
|
||
<input type="hidden" name="email" value="<%= email %>" /> | ||
|
||
<p class="actions"><a href="/idp/login">Back to Log In</a></p> | ||
|
||
<p class="actions"> | ||
<button type="submit" name="submit" class="link">Send Another Email</button> | ||
</p> | ||
</form> |
55 changes: 16 additions & 39 deletions
55
templates/identity/email-password/forgot-password.html.ejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
<title>Forgot password</title> | ||
<link rel="stylesheet" href="/.well_known/css/styles/main.css" type="text/css"> | ||
</head> | ||
<body> | ||
<header> | ||
<a href="/"><img src="/.well_known/css/images/solid.svg" alt="[Solid logo]" /></a> | ||
<h1>Community Solid Server</h1> | ||
</header> | ||
<main> | ||
<h1>Forgot password</h1> | ||
<form action="/idp/forgotpassword" method="post"> | ||
<%if (errorMessage) { %> | ||
<p class="error"><%= errorMessage %></p> | ||
<% } %> | ||
<h1>Forgot password</h1> | ||
<form action="/idp/forgotpassword" method="post"> | ||
<%if (errorMessage) { %> | ||
<p class="error"><%= errorMessage %></p> | ||
<% } %> | ||
|
||
<fieldset> | ||
<ol> | ||
<li> | ||
<label for="email">Email</label> | ||
<input id="email" type="email" name="email" autofocus> | ||
</li> | ||
</ol> | ||
</fieldset> | ||
<fieldset> | ||
<ol> | ||
<li> | ||
<label for="email">Email</label> | ||
<input id="email" type="email" name="email" autofocus> | ||
</li> | ||
</ol> | ||
</fieldset> | ||
|
||
<p class="actions"><button type="submit" name="submit">Send recovery email</button></p> | ||
<p class="actions"><button type="submit" name="submit">Send recovery email</button></p> | ||
|
||
<p class="actions"><a href="/idp/login" class="link">Log in</a></p> | ||
</form> | ||
</main> | ||
<footer> | ||
<p> | ||
©2019–2021 <a href="https://inrupt.com/">Inrupt Inc.</a> | ||
and <a href="https://www.imec-int.com/">imec</a> | ||
</p> | ||
</footer> | ||
</body> | ||
</html> | ||
<p class="actions"><a href="/idp/login" class="link">Log in</a></p> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
<title>Log in</title> | ||
<link rel="stylesheet" href="/.well_known/css/styles/main.css" type="text/css"> | ||
</head> | ||
<body> | ||
<header> | ||
<a href="/"><img src="/.well_known/css/images/solid.svg" alt="[Solid logo]" /></a> | ||
<h1>Community Solid Server</h1> | ||
</header> | ||
<main> | ||
<h1>Log in</h1> | ||
<form action="/idp/login" method="post"> | ||
<%if (errorMessage) { %> | ||
<p class="error"><%= errorMessage %></p> | ||
<% } %> | ||
<h1>Log in</h1> | ||
<form action="/idp/login" method="post"> | ||
<%if (errorMessage) { %> | ||
<p class="error"><%= errorMessage %></p> | ||
<% } %> | ||
|
||
<fieldset> | ||
<legend>Your account</legend> | ||
<ol> | ||
<li> | ||
<label for="email">Email</label> | ||
<input id="email" type="email" name="email" autofocus <% if (prefilled.email) { %> value="<%= prefilled.email %>" <% } %>> | ||
</li> | ||
<li> | ||
<label for="password">Password</label> | ||
<input id="password" type="password" name="password"> | ||
</li> | ||
<li class="checkbox"> | ||
<label><input type="checkbox" name="remember" value="yes" checked>Stay logged in</label> | ||
</li> | ||
</ol> | ||
</fieldset> | ||
<fieldset> | ||
<legend>Your account</legend> | ||
<ol> | ||
<li> | ||
<label for="email">Email</label> | ||
<input id="email" type="email" name="email" autofocus <% if (prefilled.email) { %> value="<%= prefilled.email %>" <% } %>> | ||
</li> | ||
<li> | ||
<label for="password">Password</label> | ||
<input id="password" type="password" name="password"> | ||
</li> | ||
<li class="checkbox"> | ||
<label><input type="checkbox" name="remember" value="yes" checked>Stay logged in</label> | ||
</li> | ||
</ol> | ||
</fieldset> | ||
|
||
<p class="actions"><button type="submit" name="submit">Log in</button></p> | ||
<p class="actions"><button type="submit" name="submit">Log in</button></p> | ||
|
||
<ul class="actions"> | ||
<li><a href="/idp/register" class="link">Sign up</a></li> | ||
<li><a href="/idp/forgotpassword" class="link">Forgot password</a></li> | ||
</ul> | ||
</form> | ||
</main> | ||
<footer> | ||
<p> | ||
©2019–2021 <a href="https://inrupt.com/">Inrupt Inc.</a> | ||
and <a href="https://www.imec-int.com/">imec</a> | ||
</p> | ||
</footer> | ||
</body> | ||
</html> | ||
<ul class="actions"> | ||
<li><a href="/idp/register" class="link">Sign up</a></li> | ||
<li><a href="/idp/forgotpassword" class="link">Forgot password</a></li> | ||
</ul> | ||
</form> |
Oops, something went wrong.