check if code exists
This commit is contained in:
parent
5c3025363f
commit
24e44e1607
@ -88,7 +88,11 @@ Security.permit(['insert', 'update', 'remove']).collections([schools, classes, w
|
|||||||
|
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
'genCode': function() {
|
'genCode': function() {
|
||||||
return Math.random().toString(36).substr(2, 6);
|
currcode = Math.random().toString(36).substr(2, 6);
|
||||||
|
while (classes.findOne({code: currcode}) !== undefined) {
|
||||||
|
currcode = Math.random().toString(36).substr(2, 6);
|
||||||
|
}
|
||||||
|
return currcode;
|
||||||
},
|
},
|
||||||
'createSchool': function(schoolname) {
|
'createSchool': function(schoolname) {
|
||||||
if (Meteor.user() !== null &&
|
if (Meteor.user() !== null &&
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user