mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
added availability
checks
This commit is contained in:
parent
7363f8b45d
commit
4388e93caa
@ -194,6 +194,24 @@ export default class UserController extends Controller {
|
||||
return res.json(req.user)
|
||||
},
|
||||
},
|
||||
"/user/username-available": async (req, res) => {
|
||||
const user = await User.findOne({
|
||||
username: req.query.username,
|
||||
})
|
||||
|
||||
return res.json({
|
||||
available: !user,
|
||||
})
|
||||
},
|
||||
"/user/email-available": async (req, res) => {
|
||||
const user = await User.findOne({
|
||||
email: req.query.email,
|
||||
})
|
||||
|
||||
return res.json({
|
||||
available: !user,
|
||||
})
|
||||
},
|
||||
"/user": {
|
||||
middlewares: ["withAuthentication"],
|
||||
fn: Schematized({
|
||||
|
Loading…
x
Reference in New Issue
Block a user