accounts.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // configure the special accounts user interface
  2. // by setting up some extra fields and specifying constraints
  3. // see:https://github.com/ianmartorell/meteor-accounts-ui-bootstrap-3/
  4. Accounts.ui.config({
  5. requestPermissions: {},
  6. extraSignupFields: [{
  7. fieldName: "first-name",
  8. fieldLabel: "First name",
  9. inputType: "text",
  10. visible: true,
  11. validate: function (value, errorFunction) {
  12. if (!value) {
  13. errorFunction("Please write your first name");
  14. return false;
  15. } else {
  16. return true;
  17. }
  18. }
  19. }, {
  20. fieldName: "last-name",
  21. fieldLabel: "Last name",
  22. inputType: "text",
  23. visible: true,
  24. }, {
  25. fieldName: 'gender',
  26. showFieldLabel: false, // If true, fieldLabel will be shown before radio group
  27. fieldLabel: 'Gender',
  28. inputType: 'radio',
  29. radioLayout: 'vertical', // It can be 'inline' or 'vertical'
  30. data: [{ // Array of radio options, all properties are required
  31. id: 1, // id suffix of the radio element
  32. label: 'Male', // label for the radio element
  33. value: 'm' // value of the radio element, this will be saved.
  34. }, {
  35. id: 2,
  36. label: 'Female',
  37. value: 'f',
  38. checked: 'checked'
  39. }],
  40. visible: true
  41. }, {
  42. fieldName: 'country',
  43. fieldLabel: 'Country',
  44. inputType: 'select',
  45. showFieldLabel: true,
  46. empty: 'Please select your country of residence',
  47. data: [{
  48. id: 1,
  49. label: 'United States',
  50. value: 'us'
  51. }, {
  52. id: 2,
  53. label: 'Spain',
  54. value: 'es',
  55. }],
  56. visible: true
  57. }, {
  58. fieldName: "terms",
  59. fieldLabel: "I accept the terms and conditions <a href=\"\">Some outrageous terms</a>",
  60. inputType: "checkbox",
  61. visible: true,
  62. saveToProfile: false,
  63. validate: function (value, errorFunction) {
  64. if (value) {
  65. return true;
  66. } else {
  67. errorFunction('You must accept the terms and conditions.');
  68. return false;
  69. }
  70. }
  71. }]
  72. });