rockq-org / austack-core

API, Console, Test of austack
32 stars 8 forks source link

注册界面,添加一个验证码字段,只有邀请码正确,才能注册 #205

Closed lymanlai closed 9 years ago

lymanlai commented 9 years ago

189

create code:

http://localhost:9001/api/users/createInvitationCode/5596b9bd30e816d8f84bba34/:invitationCode on musa will be

http://api.austack.com/api/users/createInvitationCode/5596b9bd30e816d8f84bba34/:invitationCode

lymanlai commented 9 years ago

screen shot 2015-08-10 at 10 31 46 am

lymanlai commented 9 years ago

http://localhost:9001/api/users/createInvitationCode/5596b9bd30e816d8f84bba34/:invitationCode on musa will be

http://api.austack.com/api/users/createInvitationCode/5596b9bd30e816d8f84bba34/:invitationCode

screen shot 2015-08-10 at 11 12 50 am screen shot 2015-08-10 at 11 12 55 am

lymanlai commented 9 years ago

screen shot 2015-08-10 at 11 18 29 am

hailiang-wang commented 9 years ago

@lymanlai What this http://api.austack.com/api/users/createInvitationCode/5596b9bd30e816d8f84bba34/:invitationCode used for ?

hailiang-wang commented 9 years ago

@lymanlai What's the data format to create an Invitation Code ?

hailiang-wang commented 9 years ago

The model definition

/**
 * The InvitationCode model definition
 * @type {Object}
 * @property {String} name - The name of this invitationCode
 * @property {String} info - Details about this invitationCode
 * @property {Boolean} active - Flag indicating this invitationCode is active
 */
var InvitationCodeDefinition = {
  invitationCode: String
};

Sample

 {
  invitationCode: xx # some Non-sequential, not predictable, unique string
};
nihgwu commented 9 years ago

there should be a field to indicate whether it's used or not, or a userID to indicate who use it

hailiang-wang commented 9 years ago

@nihgwu we made it simple, just one string, it is Non-sequential, not predictable, unique string.

Just save time.

lymanlai commented 9 years ago

@nihgwu already done in code, but not work that if we do it from mongodb cli

InvitationCodeSchema
  .path('invitationCode')
  .validate(validateUniqueInvitationCode, 'The specified invitationCode is already in use.');
hailiang-wang commented 9 years ago

It is not just a compromise, from the security aspect, it is acceptable.

hailiang-wang commented 9 years ago

Collection: db.getCollection('invitationcodes')

{
  "invitationCode": ""
}