init
This commit is contained in:
29 files changed
+2880
No files matched your search
@@ -0,0 +1,2 @@
|
||||
node_modules/
|
||||
*.env
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Token {
|
||||
constructor({ access_token, expires_in, id, name }) {
|
||||
this.access_token = access_token
|
||||
this.expires_in = expires_in
|
||||
this.id = id
|
||||
this.name = name
|
||||
}
|
||||
}
|
||||
|
||||
export default Token
|
||||
@@ -0,0 +1,79 @@
|
||||
import got from 'got'
|
||||
|
||||
import Token from './Token.js'
|
||||
|
||||
const cached = {}
|
||||
|
||||
function _cache(code, token) {
|
||||
setTimeout(() => {
|
||||
delete cached[code]
|
||||
}, 60e3)
|
||||
|
||||
cached[code] = token
|
||||
return token
|
||||
}
|
||||
|
||||
function discord(code, top) {
|
||||
if (cached[code]) return cached[code]
|
||||
|
||||
const DISCORD_APP_ID = process.env[`DISCORD_APP_ID_${top}`],
|
||||
DISCORD_APP_SECRET = process.env[`DISCORD_APP_SECRET_${top}`],
|
||||
REDIRECT_URI = process.env[`REDIRECT_URI_${top}`]
|
||||
|
||||
return got
|
||||
.post(`https://discord.com/api/oauth2/token`, {
|
||||
form: {
|
||||
client_id: DISCORD_APP_ID,
|
||||
client_secret: DISCORD_APP_SECRET,
|
||||
code,
|
||||
grant_type: 'authorization_code',
|
||||
redirect_uri: REDIRECT_URI,
|
||||
state: 'discord',
|
||||
},
|
||||
})
|
||||
.json()
|
||||
.then(({ access_token, expires_in, refresh_token }) => {
|
||||
return got('https://discord.com/api/oauth2/@me', {
|
||||
headers: { authorization: 'Bearer ' + access_token },
|
||||
})
|
||||
.json()
|
||||
.then(({ user: { id, username, discriminator } }) =>
|
||||
_cache(
|
||||
code,
|
||||
new Token({
|
||||
access_token,
|
||||
expires_in,
|
||||
refresh_token,
|
||||
id,
|
||||
name: `${username}#${discriminator}`,
|
||||
})
|
||||
)
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
async function facebook(code, top) {
|
||||
if (cached[code]) return cached[code]
|
||||
|
||||
return got(
|
||||
`https://graph.facebook.com/v12.0/oauth/access_token?client_id=${FACEBOOK_APP_ID}&redirect_uri=${REDIRECT_URI}&client_secret=${FACEBOOK_APP_SECRET}&code=${code}`
|
||||
)
|
||||
.json()
|
||||
.then(({ access_token, expires_in }) =>
|
||||
got(`https://graph.facebook.com/me?access_token=${access_token}`)
|
||||
.json()
|
||||
.then(({ id, name }) =>
|
||||
_cache(
|
||||
code,
|
||||
new Token({
|
||||
access_token,
|
||||
expires_in,
|
||||
id,
|
||||
name,
|
||||
})
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
export { discord, facebook }
|
||||
@@ -0,0 +1,15 @@
|
||||
import dotenv from 'dotenv'
|
||||
|
||||
const env = process.env.NODE_ENV,
|
||||
dotfile = {
|
||||
production: '.env',
|
||||
development: '.dev.env',
|
||||
}[env ?? 'production']
|
||||
|
||||
console.info(`env: ${env ?? '?'}`)
|
||||
|
||||
const config = dotenv.config({ path: `./${dotfile}` })
|
||||
|
||||
if (config.error) throw `enviroment file ${dotfile} not found`
|
||||
|
||||
export default config
|
||||
@@ -0,0 +1,92 @@
|
||||
import env from './env.js'
|
||||
|
||||
import express from 'express'
|
||||
import cookieParser from 'cookie-parser'
|
||||
import cors from 'cors'
|
||||
|
||||
import Database from './mongo.js'
|
||||
import logger from './log.js'
|
||||
|
||||
import login from './routes/login.js'
|
||||
import reissue from './routes/reissue.js'
|
||||
import verify from './routes/verify.js'
|
||||
|
||||
import { reIssueJwt } from './mongo/users.js'
|
||||
|
||||
const { HTTP_PORT, DOMAINS, REDIRECT_URI } = process.env
|
||||
|
||||
const http = express()
|
||||
|
||||
// express settings
|
||||
http.use(express.static('public'))
|
||||
http.use(express.json())
|
||||
http.use(
|
||||
cors({
|
||||
origin: DOMAINS.split(',').map(
|
||||
(domain) => new RegExp(`^(.*\\.)?${domain.split('.').join('\\.')}$`)
|
||||
),
|
||||
})
|
||||
)
|
||||
|
||||
http.use(cookieParser())
|
||||
|
||||
http.set('views', './views')
|
||||
http.set('view engine', 'ejs')
|
||||
|
||||
http.use((req, res, next) => {
|
||||
req.realIp = req.get('cf-connecting-ip') ?? req.get('x-real-ip') ?? req.ip
|
||||
req.top = DOMAINS.split(',').find((domain) =>
|
||||
req.get('host').endsWith(domain)
|
||||
)
|
||||
|
||||
next()
|
||||
})
|
||||
|
||||
http.use(login)
|
||||
http.use(reissue)
|
||||
http.use(verify)
|
||||
|
||||
http.listen(HTTP_PORT, () => {
|
||||
console.log(`HTTP Listening: ${HTTP_PORT}`)
|
||||
})
|
||||
|
||||
http.get('/', (req, res) => {
|
||||
const host = req.get('host'),
|
||||
top = req.top
|
||||
|
||||
if (!top) {
|
||||
logger.warn({ host, ip: req.realIp }, `Invalid domain`)
|
||||
return res.status(400).end('Invalid domain')
|
||||
}
|
||||
|
||||
logger.debug(
|
||||
{
|
||||
host,
|
||||
top,
|
||||
ip: req.realIp,
|
||||
},
|
||||
`Homepage hit`
|
||||
)
|
||||
|
||||
reIssueJwt(req.cookies[`${top}_jwt`])
|
||||
|
||||
res.render('index.ejs', {
|
||||
meta: {
|
||||
top,
|
||||
host,
|
||||
|
||||
REDIRECT_URI,
|
||||
socials: {
|
||||
DISCORD_APP_ID: process.env[`DISCORD_APP_ID_${top}`],
|
||||
// FACEBOOK_APP_ID: process.env[`FACEBOOK_APP_ID_${top}`],
|
||||
},
|
||||
customs: {
|
||||
colors: {
|
||||
primary: process.env[`COLOR_PRIMARY_${top}`],
|
||||
secondary: process.env[`COLOR_SECONDARY_${top}`],
|
||||
},
|
||||
REDIRECT_URI: process.env[`REDIRECT_URI_${top}`],
|
||||
},
|
||||
},
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,35 @@
|
||||
import jwt from 'jsonwebtoken'
|
||||
|
||||
const { WEBTOKEN_SECRET, STALE_JWT } = process.env
|
||||
|
||||
function generate(payload) {
|
||||
return jwt.sign(payload, WEBTOKEN_SECRET)
|
||||
}
|
||||
|
||||
function decode(token) {
|
||||
try {
|
||||
return jwt.decode(token)
|
||||
} catch (err) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function validate(token) {
|
||||
try {
|
||||
return !!jwt.verify(token, WEBTOKEN_SECRET)
|
||||
} catch (err) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function stale(token) {
|
||||
const udata = decode(token)
|
||||
|
||||
if (udata) {
|
||||
if (new Date().getTime() / 1e3 - udata.iat > STALE_JWT) {
|
||||
return true
|
||||
} else return false
|
||||
} else return null
|
||||
}
|
||||
|
||||
export { generate, decode, validate, stale }
|
||||
@@ -0,0 +1,7 @@
|
||||
import pino from 'pino'
|
||||
|
||||
const logger = pino({
|
||||
level: [{ development: 'debug', production: 'info' }[process.env.NODE_ENV]],
|
||||
})
|
||||
|
||||
export default logger
|
||||
@@ -0,0 +1,37 @@
|
||||
import mongoose from 'mongoose'
|
||||
import logger from './log.js'
|
||||
|
||||
const log = logger.child({ module: 'mongo' })
|
||||
|
||||
const {
|
||||
MONGO_HOST,
|
||||
MONGO_PORT,
|
||||
MONGO_NAME,
|
||||
MONGO_AUTH = 'admin',
|
||||
MONGO_USER,
|
||||
MONGO_PASS,
|
||||
} = process.env
|
||||
|
||||
mongoose.connect(`mongodb://${MONGO_HOST}:${MONGO_PORT}/${MONGO_NAME}`, {
|
||||
auth: { authSource: MONGO_AUTH },
|
||||
user: MONGO_USER,
|
||||
pass: MONGO_PASS,
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
// useFindAndModify: false,
|
||||
})
|
||||
|
||||
var db = mongoose.connection
|
||||
|
||||
db.on('error', (err) => {
|
||||
log.fatal(err, 'db error')
|
||||
throw err
|
||||
})
|
||||
|
||||
db.once('open', () => {
|
||||
log.info('db connected')
|
||||
})
|
||||
|
||||
var Database = {}
|
||||
|
||||
export default Database
|
||||
@@ -0,0 +1,20 @@
|
||||
import mongoose from 'mongoose'
|
||||
|
||||
const user = new mongoose.Schema(
|
||||
{
|
||||
id: String,
|
||||
uname: String,
|
||||
pass: String,
|
||||
banned: Boolean,
|
||||
socials: {},
|
||||
},
|
||||
{
|
||||
collection: 'users',
|
||||
timestamps: { createdAt: 'createdAt', updatedAt: 'updatedAt' },
|
||||
}
|
||||
)
|
||||
|
||||
const User = mongoose.model('User', user)
|
||||
|
||||
export default User
|
||||
export { User, user }
|
||||
@@ -0,0 +1,73 @@
|
||||
import { v4 as uuid } from 'uuid'
|
||||
import bcrypt from 'bcrypt'
|
||||
|
||||
import User from './models/user.js'
|
||||
import { decode, generate, validate } from '../jwt.js'
|
||||
|
||||
function putUser({ uname, pass, socials }) {
|
||||
return User.create({
|
||||
id: uuid(),
|
||||
uname,
|
||||
pass: bcrypt.hashSync(pass, 10),
|
||||
banned: false,
|
||||
socials,
|
||||
})
|
||||
}
|
||||
|
||||
function getUserUname(uname) {
|
||||
return User.findOne({ uname })
|
||||
}
|
||||
|
||||
function getUserUuid(id) {
|
||||
return User.findOne({ id })
|
||||
}
|
||||
|
||||
async function getUserUnamePass(uname, pass) {
|
||||
const user = await getUserUname(uname)
|
||||
|
||||
if (user !== null) if (bcrypt.compareSync(pass, user.pass)) return user
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
function getUserSocialId(platform, id) {
|
||||
return User.findOne({ [`socials.${platform}.id`]: id })
|
||||
}
|
||||
|
||||
async function reIssueJwt(token) {
|
||||
if (validate(token)) {
|
||||
const udata = decode(token)
|
||||
|
||||
const nudata = stripUser(await getUserUuid(udata.id))
|
||||
|
||||
const payload = {
|
||||
udata: nudata,
|
||||
jwt: generate(nudata),
|
||||
}
|
||||
|
||||
return payload
|
||||
} else return false
|
||||
}
|
||||
|
||||
function stripUser(user) {
|
||||
let udata = {
|
||||
id: user.id,
|
||||
uname: user.uname,
|
||||
socials: {},
|
||||
}
|
||||
|
||||
for (let platform in user.socials) {
|
||||
udata.socials[platform] = encodeURI(user.socials[platform].name)
|
||||
}
|
||||
|
||||
return udata
|
||||
}
|
||||
|
||||
export {
|
||||
putUser,
|
||||
getUserUname,
|
||||
getUserUnamePass,
|
||||
getUserSocialId,
|
||||
getUserUuid,
|
||||
reIssueJwt,
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "auth",
|
||||
"version": "0.1.0",
|
||||
"description": "Cross subdomain authentication server",
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"dev": "NODE_ENV=development nodemon index",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/Maathias/auth.git"
|
||||
},
|
||||
"author": "Mateusz Pstrucha",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Maathias/auth/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Maathias/auth#readme",
|
||||
"dependencies": {
|
||||
"bcrypt": "^5.0.1",
|
||||
"body-parser": "^1.19.0",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^10.0.0",
|
||||
"ejs": "^3.1.6",
|
||||
"express": "^4.17.1",
|
||||
"got": "^12.0.0",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"mongoose": "^6.1.3",
|
||||
"pino": "^7.6.2",
|
||||
"uuid": "^8.3.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
.biswitch {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
padding: 0.3em 0.5em;
|
||||
border: 2px solid white;
|
||||
border-radius: 3px;
|
||||
width: 11em;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.biswitch .b {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.biswitch::after {
|
||||
content: '';
|
||||
display: block;
|
||||
height: 100%;
|
||||
width: 50%;
|
||||
background-color: var(--color-primary);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: -1;
|
||||
transform: skewX(-20deg) scaleY(1.1) scaleX(1.1) translateX(-4px);
|
||||
|
||||
transition: 0.2s;
|
||||
transition-property: left, transform;
|
||||
}
|
||||
|
||||
.biswitch.second::after {
|
||||
left: 50%;
|
||||
transform: skewX(-20deg) scaleX(1.2) translateX(2px);
|
||||
}
|
||||
|
||||
.biswitch div {
|
||||
display: inline-block;
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
.fields.social-only > .input.text input {
|
||||
border-bottom: 3px solid var(--color-secondary);
|
||||
}
|
||||
|
||||
.fields.logedin > .input:not(.button) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 100%;
|
||||
margin-bottom: 2em;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.input:last-child {
|
||||
margin-bottom: unset;
|
||||
}
|
||||
|
||||
.input label {
|
||||
font-size: 75%;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.input input {
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
border: none;
|
||||
background: unset;
|
||||
border-bottom: 1px solid white;
|
||||
color: inherit;
|
||||
border-radius: unset;
|
||||
}
|
||||
|
||||
.input.checkbox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: right;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.input.checkbox input {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border: 2px solid white;
|
||||
margin: 0 0.5em;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 0 4px #0005 inset;
|
||||
transition: box-shadow 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.input.checkbox input:checked {
|
||||
box-shadow: 0 0 2px 7px var(--color-primary) inset;
|
||||
}
|
||||
|
||||
.input.checkbox input::after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
/* border: 2px solid red; */
|
||||
box-sizing: border-box;
|
||||
background-color: white;
|
||||
border-radius: 3px;
|
||||
/* position: relative; */
|
||||
left: 0;
|
||||
top: 0;
|
||||
/* margin: 0; */
|
||||
/* top: calc(50% - 2px); */
|
||||
transform: scale(0);
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.input.checkbox input:checked::after {
|
||||
transform: scale(0.6);
|
||||
}
|
||||
|
||||
.input.text input,
|
||||
.input.button input {
|
||||
padding: 0.8em 0.2em;
|
||||
width: 100%;
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
border: none;
|
||||
background: unset;
|
||||
border-bottom: 1px solid white;
|
||||
color: inherit;
|
||||
border-radius: unset;
|
||||
}
|
||||
|
||||
.input.text input:focus {
|
||||
outline: unset;
|
||||
border-bottom-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.input input::placeholder {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.input.text:focus-within:before {
|
||||
content: '';
|
||||
width: 0.5em;
|
||||
height: 0.5em;
|
||||
/* background-color: red; */
|
||||
position: absolute;
|
||||
left: -2em;
|
||||
bottom: 0.85em;
|
||||
border-width: 2px;
|
||||
border-style: solid solid none none;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.input.button input {
|
||||
border: 1px solid white;
|
||||
text-transform: uppercase;
|
||||
transition-duration: 0.2s;
|
||||
transition-property: background-color, box-shadow;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.input.button input:disabled {
|
||||
color: #ccc;
|
||||
box-shadow: 0 0 10px 0px #00000033 inset;
|
||||
}
|
||||
|
||||
.input.button input:not(:disabled) {
|
||||
background-color: var(--color-primary);
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.input.button input:not(:disabled):hover {
|
||||
box-shadow: 0 5px 6px -2px #ffffff6e;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
.wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.content {
|
||||
position: relative;
|
||||
height: 100vh;
|
||||
width: 25rem;
|
||||
overflow: hidden auto;
|
||||
|
||||
background-color: hsl(221deg 24% 18% / 27%);
|
||||
backdrop-filter: blur(3px);
|
||||
box-shadow: 0 0 20px 4px #0000008c;
|
||||
color: #fefefe;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
.user {
|
||||
width: 100%;
|
||||
padding: 0.2em 1em;
|
||||
margin-bottom: 1em;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.user[data-logedin='true'] {
|
||||
display: initial;
|
||||
}
|
||||
|
||||
.user .uname {
|
||||
font-size: 1.5em;
|
||||
display: inline-block;
|
||||
font-family: 'Roboto Mono';
|
||||
}
|
||||
|
||||
.user .logedin {
|
||||
display: inline-block;
|
||||
font-size: 0.7em;
|
||||
color: #dddd;
|
||||
}
|
||||
|
||||
.user .socials {
|
||||
display: flex;
|
||||
padding: 0.5em 0;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
.user .socials > .platform {
|
||||
padding: 0.1em 0.5em;
|
||||
background: #fff;
|
||||
border-radius: 3px;
|
||||
color: var(--color-primary);
|
||||
text-shadow: 0 0 1px #00000038;
|
||||
}
|
||||
|
||||
.platform:not(:empty) {
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.platform:empty {
|
||||
display: none;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 160 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 116 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
+286
@@ -0,0 +1,286 @@
|
||||
const {
|
||||
host: DOMAIN,
|
||||
socials: { DISCORD_APP_ID, FACEBOOK_APP_ID },
|
||||
top: TOP,
|
||||
customs: { REDIRECT_URI },
|
||||
} = window.meta
|
||||
|
||||
document.domain = TOP
|
||||
|
||||
// extract logedin user's data from cookies
|
||||
// don't judge my 🍝
|
||||
var udata = JSON.parse(
|
||||
(document.cookie
|
||||
.split('; ')
|
||||
.map((cookie) => cookie.split('='))
|
||||
.filter(([key]) => key == `${TOP}_udata`)
|
||||
.at(0) ?? [, false])[1]
|
||||
)
|
||||
|
||||
// user's form inputs
|
||||
var inputs = {
|
||||
uname: '',
|
||||
pass: '',
|
||||
rememberme: true,
|
||||
ready: false,
|
||||
register: false,
|
||||
socials: {},
|
||||
}
|
||||
|
||||
function info(content, pending = true) {
|
||||
const el = document.querySelector('.status')
|
||||
el.setAttribute('data-content', content)
|
||||
pending ? el.classList.add('pending') : el.classList.remove('pending')
|
||||
}
|
||||
|
||||
function send() {
|
||||
info('Preparing')
|
||||
|
||||
let { ready } = inputs,
|
||||
socials = Object.keys(inputs.socials).length > 0
|
||||
|
||||
if (inputs.register) {
|
||||
if (!ready) return info('Please enter login info', false)
|
||||
} else if (!socials) if (!ready) return info('Please enter login info', false)
|
||||
|
||||
fetch('/login', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(inputs),
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then(({ success, nuinfo: uinfo, error, registerpls }) => {
|
||||
if (success) {
|
||||
info('Success', false)
|
||||
udata = uinfo
|
||||
|
||||
inputs.socials = {}
|
||||
document.querySelector('input[id=password]').value = ''
|
||||
fieldChange()
|
||||
|
||||
document
|
||||
.querySelectorAll('.fetched')
|
||||
.forEach((el) => el.classList.remove('fetched'))
|
||||
|
||||
displayUser(udata)
|
||||
window.opener?.return(udata)
|
||||
} else {
|
||||
info(error, false)
|
||||
if (registerpls) {
|
||||
document.querySelector('.fields').classList.add('social-only')
|
||||
|
||||
doRegister(true)
|
||||
}
|
||||
}
|
||||
fieldChange()
|
||||
})
|
||||
|
||||
info('Sending')
|
||||
}
|
||||
|
||||
function displayUser({ uname, socials, logedin }) {
|
||||
document.querySelector('.user').setAttribute('data-logedin', true)
|
||||
document.querySelector('.user .uname').textContent = uname
|
||||
document.querySelector('.user .logedin').textContent = new Date(
|
||||
logedin
|
||||
).toLocaleString()
|
||||
|
||||
document.querySelector(
|
||||
'.user .socials .platform[data-social=facebook]'
|
||||
).textContent = decodeURI(socials.facebook ?? '')
|
||||
document.querySelector(
|
||||
'.user .socials .platform[data-social=discord]'
|
||||
).textContent = decodeURI(socials.discord ?? '')
|
||||
}
|
||||
|
||||
function logout() {
|
||||
document.querySelector('.user').setAttribute('data-logedin', false)
|
||||
|
||||
function delCookie(name) {
|
||||
document.cookie = `${name}=; Path=/; Expires=${new Date(
|
||||
-1
|
||||
)}; Domain=.${TOP}`
|
||||
}
|
||||
|
||||
delCookie(`${TOP}_jwt`)
|
||||
delCookie(`${TOP}_udata`)
|
||||
udata = false
|
||||
|
||||
fieldChange()
|
||||
}
|
||||
|
||||
function promptLogin(platform) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// target oauth uri, with window sizes
|
||||
const { target, width, height } = {
|
||||
facebook: {
|
||||
target: `https://www.facebook.com/v11.0/dialog/oauth?client_id=${FACEBOOK_APP_ID}&redirect_uri=${REDIRECT_URI}&state=facebook`,
|
||||
width: 400,
|
||||
height: 550,
|
||||
},
|
||||
discord: {
|
||||
target: `https://discord.com/api/oauth2/authorize?client_id=${DISCORD_APP_ID}&redirect_uri=${REDIRECT_URI}&response_type=code&scope=identify&state=discord`,
|
||||
width: 450,
|
||||
height: 750,
|
||||
},
|
||||
}[platform]
|
||||
|
||||
delete localStorage.code
|
||||
|
||||
let popup = window.open(
|
||||
target,
|
||||
`login with platform`,
|
||||
`scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=${width},height=${height}`
|
||||
)
|
||||
|
||||
// periodically check if the login is complete
|
||||
let interval = setInterval(() => {
|
||||
// window manually closed, login failed
|
||||
if (popup.closed) {
|
||||
clearInterval(interval)
|
||||
return reject('Failed to log in')
|
||||
}
|
||||
|
||||
if (localStorage.code) {
|
||||
// parse and cleanup fetched code
|
||||
let code = JSON.parse(localStorage.code)
|
||||
delete localStorage.code
|
||||
|
||||
// oauth state mismatch
|
||||
if (code.state != platform) reject('Invalid state')
|
||||
// somehow there's no code
|
||||
else if (typeof code.code != 'string') reject('Log in denied')
|
||||
else resolve(code)
|
||||
|
||||
// cleanup the timer and popup window
|
||||
clearInterval(interval)
|
||||
popup.close()
|
||||
}
|
||||
}, 5e2)
|
||||
})
|
||||
}
|
||||
|
||||
function doRegister(on) {
|
||||
inputs.register = on ?? !inputs.register
|
||||
|
||||
const biswitch = document.querySelector('.biswitch')
|
||||
|
||||
if (inputs.register) biswitch.classList.add('second')
|
||||
else biswitch.classList.remove('second')
|
||||
|
||||
document.querySelector('#submit').value = inputs.register
|
||||
? 'sign up'
|
||||
: 'log in'
|
||||
|
||||
fieldChange()
|
||||
}
|
||||
|
||||
function submitButton(
|
||||
display = inputs.ready,
|
||||
label = inputs.register ? 'sign up' : 'log in'
|
||||
) {
|
||||
let submit = document.querySelector('input[id=submit]')
|
||||
|
||||
label && (submit.value = label)
|
||||
inputs.ready = display
|
||||
|
||||
if (display) submit.removeAttribute('disabled')
|
||||
else submit.setAttribute('disabled', true)
|
||||
}
|
||||
|
||||
function fieldChange() {
|
||||
inputs.uname = document.querySelector('input[id=username]').value
|
||||
inputs.pass = document.querySelector('input[id=password]').value
|
||||
inputs.rememberme = document.querySelector('input[id=rememberme]').checked
|
||||
|
||||
let fields = document.querySelector('.fields')
|
||||
if (udata) fields.classList.add('logedin')
|
||||
else fields.classList.remove('logedin')
|
||||
|
||||
let { uname, pass, register } = inputs
|
||||
socials = Object.keys(inputs.socials).length > 0
|
||||
|
||||
// remove highlight on input
|
||||
if (uname || pass) fields.classList.remove('social-only')
|
||||
|
||||
// loged in, socials added
|
||||
if (udata && socials && register) {
|
||||
submitButton(true, 'add to account')
|
||||
} else {
|
||||
if (register) {
|
||||
if (uname.length > 0 && pass.length > 0 && socials) submitButton(true)
|
||||
else submitButton(false)
|
||||
} else {
|
||||
if ((uname.length > 0 && pass.length > 0) || socials) submitButton(true)
|
||||
else submitButton(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('load', (e) => {
|
||||
// display loged in user data
|
||||
udata && displayUser(udata)
|
||||
fieldChange()
|
||||
|
||||
const fields = document.querySelector('.fields')
|
||||
|
||||
// login button activation
|
||||
fields.onkeyup = fields.onchange = fieldChange
|
||||
|
||||
// submit handler
|
||||
document.querySelector('#submit').onclick = send
|
||||
fields.addEventListener('keydown', (e) => e.key == 'Enter' && send())
|
||||
|
||||
// logout button
|
||||
document.querySelector('#logout').onclick = logout
|
||||
|
||||
// close popup button
|
||||
if (window?.opener?.return) {
|
||||
r = document.querySelector('.return')
|
||||
r.classList.add('enabled')
|
||||
r.onclick = () => window.opener?.return(null)
|
||||
}
|
||||
|
||||
// login/register switch
|
||||
document.querySelector('.biswitch').onclick = () => doRegister()
|
||||
|
||||
// enable external login
|
||||
for (let platform in window.meta.socials) {
|
||||
let label = platform.split('_')[0].toLowerCase()
|
||||
document
|
||||
.querySelector(`.socials .external[data-social=${label}]`)
|
||||
.removeAttribute('disabled')
|
||||
}
|
||||
|
||||
// external login buttons
|
||||
document
|
||||
.querySelector('.content > .socials')
|
||||
.addEventListener('click', function (e) {
|
||||
if (this === e.target) return
|
||||
|
||||
if (e.target.hasAttribute('disabled')) return
|
||||
|
||||
let social = e.target.getAttribute('data-social')
|
||||
|
||||
info(`Connecting ${social} account`)
|
||||
|
||||
promptLogin(social)
|
||||
.then((data) => {
|
||||
inputs.socials[social] = data
|
||||
|
||||
info(`Connected ${social}`, false)
|
||||
|
||||
document
|
||||
.querySelector(`.external[data-social=${social}]`)
|
||||
.classList.add('fetched')
|
||||
|
||||
fieldChange()
|
||||
|
||||
if (!inputs.register) send()
|
||||
})
|
||||
.catch((err) => {
|
||||
console.warn(err)
|
||||
info(`Failed to connect ${social}`, false)
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,171 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Roboto&family=Roboto+Mono');
|
||||
|
||||
@import url('css/layout.css');
|
||||
@import url('css/inputs.css');
|
||||
@import url('css/user.css');
|
||||
@import url('css/biswitch.css');
|
||||
|
||||
body {
|
||||
--color-primary: #f7b440;
|
||||
--color-secondary: hsl(7, 82%, 63%);
|
||||
|
||||
margin: 0;
|
||||
background: linear-gradient(
|
||||
-45deg,
|
||||
var(--color-primary) 0%,
|
||||
var(--color-secondary) 100%
|
||||
),
|
||||
url('/img/papyrus-dark.png');
|
||||
background-blend-mode: difference;
|
||||
font-family: Roboto;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 25%;
|
||||
margin-bottom: 3em;
|
||||
border-radius: 100%;
|
||||
box-shadow: 2px 6px 10px 2px #0005;
|
||||
}
|
||||
|
||||
.badge {
|
||||
width: 100%;
|
||||
/* border-left: 4px solid var(--color-primary); */
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.content > :is(h1, h2, h3, h4, h5, h6) {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
margin-top: unset;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.fields {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 0.5em 3em;
|
||||
}
|
||||
|
||||
.separator {
|
||||
margin: 1em 0;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
.separator:before,
|
||||
.separator:after {
|
||||
content: '';
|
||||
width: calc(50% - 7em);
|
||||
height: 0.5em;
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
left: 1em;
|
||||
border-bottom: 1px solid #dddd;
|
||||
}
|
||||
|
||||
.separator:after {
|
||||
left: unset;
|
||||
right: 1em;
|
||||
}
|
||||
|
||||
.content > .socials {
|
||||
display: flex;
|
||||
padding: 0.3em 1em;
|
||||
box-sizing: border-box;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.content > .socials > .external {
|
||||
border: 1px solid white;
|
||||
padding: 0.5em 0.2em;
|
||||
box-sizing: border-box;
|
||||
width: calc(33% - 0.5em);
|
||||
text-align: center;
|
||||
margin-right: 0.5em;
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.external.fetched {
|
||||
background-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.external[disabled] {
|
||||
color: #ccc;
|
||||
border-color: #ccc !important;
|
||||
box-shadow: 0 0 6px #5555 inset;
|
||||
}
|
||||
|
||||
.status {
|
||||
text-align: center;
|
||||
margin: 1em 0.5em;
|
||||
border-top: unset;
|
||||
}
|
||||
|
||||
.status[data-content=''] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.status:before {
|
||||
content: attr(data-content);
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.status.pending:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
border-right: 1px solid white;
|
||||
animation: spin 1s infinite linear;
|
||||
transform-origin: right;
|
||||
}
|
||||
|
||||
.copy {
|
||||
position: relative;
|
||||
bottom: 0;
|
||||
font-size: 75%;
|
||||
margin: 0.5em 0;
|
||||
color: #dddd;
|
||||
}
|
||||
|
||||
.return {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
padding: 1em;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.8em;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.return:not(.enabled) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.return::before {
|
||||
content: '';
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
transform: rotate(-45deg);
|
||||
display: block;
|
||||
border: 2px white;
|
||||
border-style: solid none none solid;
|
||||
bottom: 0;
|
||||
margin-right: 0.7em;
|
||||
float: left;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<body>
|
||||
Logowanie...
|
||||
<br>
|
||||
Jeżeli to okno nie zamknie się automatycznie, spróbuj ponownie.
|
||||
</body>
|
||||
|
||||
<script>
|
||||
try {
|
||||
const params = new URLSearchParams(document.location.search)
|
||||
|
||||
localStorage.code = JSON.stringify({
|
||||
code: params.get('code'),
|
||||
state: params.get('state')
|
||||
})
|
||||
document.write(localStorage.code)
|
||||
} catch (err) {
|
||||
document.write(err)
|
||||
}
|
||||
</script>
|
||||
+209
@@ -0,0 +1,209 @@
|
||||
import { Router } from 'express'
|
||||
|
||||
import { discord, facebook } from '../code.js'
|
||||
import { decode, generate, validate } from '../jwt.js'
|
||||
import logger from '../log.js'
|
||||
|
||||
import {
|
||||
getUserSocialId,
|
||||
getUserUname,
|
||||
getUserUnamePass,
|
||||
putUser,
|
||||
} from '../mongo/users.js'
|
||||
import Token from '../Token.js'
|
||||
|
||||
const log = logger.child({ route: 'login' })
|
||||
|
||||
const { DOMAINS } = process.env
|
||||
|
||||
const platforms = {
|
||||
discord,
|
||||
}
|
||||
|
||||
const router = Router()
|
||||
export default router
|
||||
|
||||
router.post('/login', async (req, res) => {
|
||||
const top = DOMAINS.split(',').find((domain) =>
|
||||
req.get('host').endsWith(domain)
|
||||
)
|
||||
|
||||
if (!top) {
|
||||
return res.status(400).end('Invalid domain')
|
||||
}
|
||||
|
||||
let { socials, uname, pass, rememberme = true, register = false } = req.body,
|
||||
jwt = req.cookies[`${top}_jwt`],
|
||||
uinfo = JSON.parse(req.cookies[`${top}_udata`] ?? 'null')
|
||||
|
||||
let udata = jwt && uinfo && validate(jwt) && decode(jwt)
|
||||
|
||||
function sendJwt(user) {
|
||||
let nuinfo = {
|
||||
id: user.id,
|
||||
uname: user.uname,
|
||||
socials: {},
|
||||
logedin: new Date().getTime(),
|
||||
}
|
||||
|
||||
for (let platform in user.socials) {
|
||||
nuinfo.socials[platform] = encodeURI(user.socials[platform].name)
|
||||
}
|
||||
|
||||
const cookieMeta = {
|
||||
domain: `.${top}`,
|
||||
encode: String,
|
||||
...(rememberme && { maxAge: 3.154e10 }),
|
||||
}
|
||||
|
||||
let jwt = generate(nuinfo)
|
||||
|
||||
log.info({ nuinfo, top, ip: req.realIp }, `Login successful`)
|
||||
|
||||
res.cookie(`${top}_jwt`, jwt, cookieMeta)
|
||||
res.cookie(`${top}_udata`, JSON.stringify(nuinfo), cookieMeta)
|
||||
|
||||
res.json({
|
||||
success: true,
|
||||
nuinfo,
|
||||
jwt,
|
||||
})
|
||||
}
|
||||
|
||||
function feedback(code, error, other) {
|
||||
if (!res.headersSent)
|
||||
res.status(code).json({
|
||||
success: false,
|
||||
error,
|
||||
...other,
|
||||
})
|
||||
}
|
||||
|
||||
var tokens = {},
|
||||
tokenOk = false
|
||||
|
||||
// auth connected platforms
|
||||
for (let platform in socials) {
|
||||
try {
|
||||
tokens[platform] = await platforms[platform]?.(
|
||||
socials[platform].code,
|
||||
top
|
||||
)
|
||||
tokenOk = tokenOk || !!tokens[platform]
|
||||
} catch (err) {
|
||||
tokens[platform] = false
|
||||
return feedback(400, `Could not verify ${platform} account`)
|
||||
}
|
||||
}
|
||||
|
||||
logger.debug(
|
||||
{ jwt, udata, body: { ...req.body, pass: '*' }, tokens },
|
||||
`Requested login/register`
|
||||
)
|
||||
|
||||
if (register) {
|
||||
if (tokenOk && udata) {
|
||||
// add to account
|
||||
} else if (uname && pass && !tokenOk) {
|
||||
// platform required
|
||||
return feedback(
|
||||
409,
|
||||
'A connected account is required to register a new account'
|
||||
)
|
||||
} else if (uname && pass && tokenOk) {
|
||||
// create account
|
||||
|
||||
// uname and pass required
|
||||
if (typeof uname != 'string' || typeof pass != 'string')
|
||||
return feedback(400, 'Username and password required')
|
||||
|
||||
// uname and pass non empty
|
||||
if (uname.length < 1 || pass.length < 1)
|
||||
return feedback(400, 'Username and password cannot be empty')
|
||||
|
||||
// username is taken
|
||||
if ((await getUserUname(uname)) !== null) {
|
||||
return feedback(409, `username '${uname}' is taken`)
|
||||
}
|
||||
|
||||
// check for existing accounts
|
||||
for (let platform in tokens) {
|
||||
let token = tokens[platform]
|
||||
|
||||
if (token instanceof Token)
|
||||
if ((await getUserSocialId(platform, token.id)) !== null) {
|
||||
// social account is already connected
|
||||
return feedback(
|
||||
409,
|
||||
`${platform} account is already connected to an existing user`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// add to db
|
||||
putUser({ uname, pass, socials: tokens })
|
||||
.then((user) => {
|
||||
log.debug(user, `Registered new user`)
|
||||
sendJwt(user)
|
||||
})
|
||||
.catch((err) => {
|
||||
log.error(err, `db error: creating a user`)
|
||||
feedback(500, `There was an error while creating your account`)
|
||||
})
|
||||
} else {
|
||||
// insufficient data
|
||||
|
||||
return feedback(
|
||||
400,
|
||||
'Username, password and at least one platform connected is required to register'
|
||||
)
|
||||
}
|
||||
} else {
|
||||
if (tokenOk) {
|
||||
// log in with platform
|
||||
|
||||
for (let platform in tokens) {
|
||||
let token = tokens[platform]
|
||||
|
||||
if (token instanceof Token) {
|
||||
let user
|
||||
try {
|
||||
user = await getUserSocialId(platform, token.id)
|
||||
} catch (err) {
|
||||
log.error(err, `db error: token login`)
|
||||
return feedback(
|
||||
500,
|
||||
`There was a problem with your ${platform} account`
|
||||
)
|
||||
}
|
||||
|
||||
if (user === null)
|
||||
return feedback(404, `${platform} account is not registered`, {
|
||||
registerpls: true,
|
||||
})
|
||||
else return sendJwt(user)
|
||||
}
|
||||
}
|
||||
} else if (uname && pass) {
|
||||
// log in with uname & pass
|
||||
|
||||
// uname and pass required
|
||||
if (typeof uname != 'string' || typeof pass != 'string')
|
||||
return feedback(400, 'Username and password required')
|
||||
|
||||
// uname and pass non empty
|
||||
if (uname.length < 1 || pass.length < 1)
|
||||
return feedback(400, 'Username and password cannot be empty')
|
||||
|
||||
getUserUnamePass(uname, pass)
|
||||
.then((user) => {
|
||||
if (user !== null) sendJwt(user)
|
||||
else feedback(404, `Username or password invalid`)
|
||||
})
|
||||
.catch((err) => {
|
||||
log.error(err, `db error: pwd login`)
|
||||
feedback(500, `Could not log in`)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,35 @@
|
||||
import { Router } from 'express'
|
||||
import { decode } from '../jwt.js'
|
||||
|
||||
import logger from '../log.js'
|
||||
import { reIssueJwt } from '../mongo/users.js'
|
||||
|
||||
const log = logger.child({ route: 'reissue' })
|
||||
|
||||
const router = Router()
|
||||
export default router
|
||||
|
||||
router.get('/reissue', async (req, res) => {
|
||||
const top = req.top,
|
||||
rememberme = req.query['rememberme'] ?? false,
|
||||
jwt = req.cookies[`${top}_jwt`],
|
||||
result = await reIssueJwt(jwt)
|
||||
|
||||
if (result) {
|
||||
const { udata, jwt: nujwt } = result,
|
||||
cookieMeta = {
|
||||
domain: `.${top}`,
|
||||
encode: String,
|
||||
...(rememberme && { maxAge: 3.154e10 }),
|
||||
}
|
||||
|
||||
udata.logedin = new Date().getTime()
|
||||
|
||||
res.cookie(`${top}_jwt`, nujwt, cookieMeta)
|
||||
res.cookie(`${top}_udata`, JSON.stringify(udata), cookieMeta)
|
||||
res.end(`successfuly re-issued your token`)
|
||||
log.debug({ before: decode(jwt), after: decode(nujwt) })
|
||||
} else {
|
||||
res.status(400).end(`could not re-issue your token`)
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,45 @@
|
||||
import { Router } from 'express'
|
||||
import { stale, validate, decode } from '../jwt.js'
|
||||
|
||||
import logger from '../log.js'
|
||||
import { getUserUuid } from '../mongo/users.js'
|
||||
|
||||
const log = logger.child({ route: 'verify' })
|
||||
|
||||
const { EXTERNAL_SECRET } = process.env
|
||||
|
||||
const router = Router()
|
||||
export default router
|
||||
|
||||
router.get('/verify', async (req, res) => {
|
||||
const top = req.top,
|
||||
jwt = req.cookies[`${top}_jwt`]
|
||||
|
||||
const ok = validate(jwt),
|
||||
isStale = stale(jwt)
|
||||
|
||||
return res.json({
|
||||
success: true,
|
||||
ok,
|
||||
stale: isStale,
|
||||
})
|
||||
})
|
||||
|
||||
router.get('/user', async (req, res) => {
|
||||
if (req.get('authorization') !== 'Bearer ' + EXTERNAL_SECRET)
|
||||
return res.status(403).end(`Bearer token required`)
|
||||
|
||||
const jwt = req.query['jwt'] ?? ''
|
||||
|
||||
const udata = decode(jwt) ?? {}
|
||||
|
||||
log.info(
|
||||
{
|
||||
udata,
|
||||
ip: req.realIp,
|
||||
},
|
||||
`User info requested`
|
||||
)
|
||||
|
||||
return res.json(await getUserUuid(udata.id))
|
||||
})
|
||||
@@ -0,0 +1,96 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<% const { top, domain, customs: {colors: {primary, secondary}} }=meta %>
|
||||
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<%- `
|
||||
<script>
|
||||
window.meta=${JSON.stringify(meta)}
|
||||
</script>
|
||||
` %>
|
||||
|
||||
<title>Login |</title>
|
||||
<link
|
||||
rel="shortcut icon"
|
||||
href="/img/domains/<%= top %>.png"
|
||||
type="image/x-icon"
|
||||
/>
|
||||
|
||||
<script src="/main.js"></script>
|
||||
<link rel="stylesheet" href="/style.css" />
|
||||
|
||||
<style>
|
||||
body {
|
||||
--color-primary: <%= primary %>;
|
||||
--color-secondary: <%= secondary %>;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<div class="content">
|
||||
<div class="return">close</div>
|
||||
<img class="logo" src="/img/domains/<%= top %>.png" alt="" srcset="" />
|
||||
|
||||
<h2 class="badge"><%= top %></h2>
|
||||
|
||||
<div class="badge user" data-logedin="false">
|
||||
<div class="uname"></div>
|
||||
<div class="logedin"></div>
|
||||
<div class="socials">
|
||||
<div class="platform" data-social="facebook"></div>
|
||||
<div class="platform" data-social="discord"></div>
|
||||
</div>
|
||||
<div class="input button">
|
||||
<input type="submit" id="logout" value="log out" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="separator">log in</div>
|
||||
|
||||
<div class="fields badge">
|
||||
<div class="input text" data-for="username">
|
||||
<label for="username" class="name">Username</label>
|
||||
<input type="text" placeholder="Your Username" id="username" />
|
||||
</div>
|
||||
|
||||
<div class="input text" data-for="password">
|
||||
<label for="password" class="name">Password</label>
|
||||
<input type="password" placeholder="Your Password" id="password" />
|
||||
</div>
|
||||
|
||||
<div class="input checkbox" data-for="rememberme">
|
||||
<label for="rememberme">Remember me</label>
|
||||
<input type="checkbox" id="rememberme" checked />
|
||||
</div>
|
||||
|
||||
<div class="input button" data-for="send">
|
||||
<input type="submit" id="submit" value="log in" disabled />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="status" data-content=""></div>
|
||||
|
||||
<div class="separator">
|
||||
<div class="biswitch">
|
||||
<div class="a">log in</div>
|
||||
<div class="b">sign up</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="socials badge">
|
||||
<div class="external" data-social="google" disabled>Google</div>
|
||||
<div class="external" data-social="facebook" disabled>Facebook</div>
|
||||
<div class="external" data-social="discord" disabled>Discord</div>
|
||||
</div>
|
||||
|
||||
<div class="copy"><%= top %> © 2020</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user