Skip to content

Commit dea5733

Browse files
Add a /login default view
1 parent 344511c commit dea5733

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

default-views/auth/login.hbs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>Login</title>
7+
<link rel="stylesheet" href="/common/css/bootstrap.min.css">
8+
</head>
9+
<body>
10+
<div class="container">
11+
<h4>Login</h4>
12+
</div>
13+
<div class="container">
14+
<form method="post" action="/login">
15+
<div class="form-group">
16+
<div class="row">
17+
<div class="col-md-12">
18+
<label for="username">Username:</label>
19+
<input type="text" class="form-control" name="username" id="username" placeholder="alice" />
20+
</div>
21+
</div>
22+
<div class="row">
23+
<div class="col-md-12">
24+
<label for="password">Password:</label>
25+
<input type="password" class="form-control" name="password" id="password" />
26+
</div>
27+
</div>
28+
<input type="hidden" name="response_type" id="response_type" value="{{response_type}}" />
29+
<input type="hidden" name="display" id="display" value="{{display}}" />
30+
<input type="hidden" name="scope" id="scope" value="{{scope}}" />
31+
<input type="hidden" name="client_id" id="client_id" value="{{client_id}}" />
32+
<input type="hidden" name="redirect_uri" id="redirect_uri" value="{{redirect_uri}}" />
33+
<input type="hidden" name="state" id="state" value="{{state}}" />
34+
<input type="hidden" name="nonce" id="nonce" value="{{nonce}}" />
35+
</div>
36+
<button type="submit" class="btn btn-primary" id="login">Login</button>
37+
38+
<div>Don't have an account? <a href="/register?{{{authParams}}}">Register</a></div>
39+
</form>
40+
</div>
41+
</body>
42+
</html>

lib/api/authn/webid-oidc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
const express = require('express')
77
const debug = require('../../debug')
88
const util = require('../../utils')
9+
const url = require('url')
910
const error = require('../../http-error')
1011
const bodyParser = require('body-parser').urlencoded({ extended: false })
1112

@@ -40,6 +41,10 @@ function middleware (oidc) {
4041
})
4142
router.post('/api/auth/select-provider', bodyParser, selectProvider)
4243

44+
router.get(['/login', '/signin'], (req, res) => {
45+
let params = Object.assign({}, req.query, { authParams: url.parse(req.url).query })
46+
res.render('auth/login', params)
47+
})
4348
router.post(['/login', '/signin'], bodyParser, login)
4449

4550
router.get('/goodbye', (req, res) => {

lib/create-app.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,6 @@ function initAuthentication (argv, app) {
206206
let oidc = OidcManager.fromServerConfig(argv)
207207
app.locals.oidc = oidc
208208

209-
// This is where the OIDC-enabled signup/signin apps live
210-
app.use('/', express.static(path.join(__dirname, '../static/oidc')))
211-
212209
// Initialize the WebId-OIDC authentication routes/api, including:
213210
// user-facing Solid endpoints (/login, /logout, /api/auth/select-provider)
214211
// and OIDC-specific ones

0 commit comments

Comments
 (0)