MCPcopy
hub / github.com/YMFE/yapi / getLoginStatus

Method getLoginStatus

server/controllers/base.js:182–203  ·  view source on GitHub ↗

* * @param {*} ctx

(ctx)

Source from the content-addressed store, hash-verified

180 */
181
182 async getLoginStatus(ctx) {
183 let body;
184 if ((await this.checkLogin(ctx)) === true) {
185 let result = yapi.commons.fieldSelect(this.$user, [
186 '_id',
187 'username',
188 'email',
189 'up_time',
190 'add_time',
191 'role',
192 'type',
193 'study'
194 ]);
195 body = yapi.commons.resReturn(result);
196 } else {
197 body = yapi.commons.resReturn(null, 40011, '请登录...');
198 }
199
200 body.ladp = await this.checkLDAP();
201 body.canRegister = await this.checkRegister();
202 ctx.body = body;
203 }
204
205 getRole() {
206 return this.$user.role;

Callers

nothing calls this directly

Calls 3

checkLoginMethod · 0.95
checkLDAPMethod · 0.95
checkRegisterMethod · 0.95

Tested by

no test coverage detected