I hereby claim:
- I am mars3142 on github.
- I am mars3142 (https://keybase.io/mars3142) on keybase.
- I have a public key whose fingerprint is B064 6F6F FE19 CB8E 62E3 FBA4 F7CC 8BA2 8852 21B0
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
router.post("/signup", async (req, res) => { | |
const username = req.body.username; | |
const password = req.body.password; | |
if (username !== undefined && username.trim().length > 0) { | |
const user = await database().ref(`accounts/${username}`).get(); | |
if (user.exists()) { | |
res.status(400).json({ | |
error: { | |
message: "Username already exists", |
router.post("/signin", async (req, res) => { | |
const username = req.body.username; | |
const password = req.body.password; | |
if (await isUserValid(username, password)) { | |
await sendToken(res, username); | |
} else { | |
res.status(401).json({ | |
error: { | |
message: "Username or password invalid", |
async function sendToken(res: Response, username: string) { | |
const token = await auth().createCustomToken(username); | |
res.status(200).json({ | |
data: { | |
username: username, | |
token: token, | |
}, | |
}); | |
} |
extends Control | |
var _api_key = "secret" | |
var _api_url = "https://project_id.cloudfunctions.net/api" | |
onready var _username = $vb/input_area/username | |
onready var _password = $vb/input_area/password | |
func _ready() -> void: |