forked from ppfun/pixelplanet
add mailverification to adminapi
This commit is contained in:
parent
c29578dfaf
commit
53fb0fe3c5
|
@ -1,10 +1,10 @@
|
|||
import express from 'express';
|
||||
|
||||
import logger from '../../core/logger';
|
||||
import RegUser from '../../data/models/RegUser';
|
||||
import { getIPFromRequest } from '../../utils/ip';
|
||||
import { compareToHash } from '../../utils/hash';
|
||||
import { APISOCKET_KEY } from '../../core/config';
|
||||
import logger from '../core/logger';
|
||||
import RegUser from '../data/models/RegUser';
|
||||
import { getIPFromRequest } from '../utils/ip';
|
||||
import { compareToHash } from '../utils/hash';
|
||||
import { APISOCKET_KEY } from '../core/config';
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
|
@ -48,6 +48,7 @@ router.post('/checklogin', async (req, res) => {
|
|||
'name',
|
||||
'email',
|
||||
'password',
|
||||
'verified',
|
||||
],
|
||||
};
|
||||
let userString;
|
||||
|
@ -100,6 +101,7 @@ router.post('/checklogin', async (req, res) => {
|
|||
id: reguser.id,
|
||||
name: reguser.name,
|
||||
email: reguser.email,
|
||||
verified: !!reguser.verified,
|
||||
},
|
||||
});
|
||||
});
|
|
@ -1,10 +0,0 @@
|
|||
# AdminAPI
|
||||
|
||||
API which is used for connecting with external applications and bridges to fetch informations.
|
||||
Modtools are in ./api
|
||||
|
||||
Connections to here just possible with header:
|
||||
|
||||
```
|
||||
Authorization: "Bearer APISOCKETKEY"
|
||||
```
|
|
@ -52,6 +52,8 @@ class MyAuthProvider:
|
|||
if not resp["success"]:
|
||||
raise Exception(resp["errors"][0])
|
||||
userdata = resp['userdata']
|
||||
if not userdata['verified']:
|
||||
raise Exception('User is not mail verified');
|
||||
return (userdata['id'], userdata['name'], userdata['email'])
|
||||
except Exception as e:
|
||||
logger.warning('Could not login via ppfun: %s', e)
|
||||
|
|
Loading…
Reference in New Issue
Block a user