accounts.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. {
  8. fieldName: "first-name",
  9. fieldLabel: "First name",
  10. inputType: "text",
  11. visible: true,
  12. validate: function (value, errorFunction) {
  13. if (!value) {
  14. errorFunction("Please write your first name");
  15. return false;
  16. }
  17. else {
  18. return true;
  19. }
  20. }
  21. },
  22. {
  23. fieldName: "last-name",
  24. fieldLabel: "Last name",
  25. inputType: "text",
  26. visible: true
  27. },
  28. {
  29. fieldName: "gender",
  30. showFieldLabel: false, // If true, fieldLabel will be shown before radio group
  31. fieldLabel: "Gender",
  32. inputType: "radio",
  33. radioLayout: "vertical", // It can be "inline" or "vertical"
  34. data: [
  35. { // Array of radio options, all properties are required
  36. id: 1, // id suffix of the radio element
  37. label: "Male", // label for the radio element
  38. value: "m" // value of the radio element, this will be saved.
  39. },
  40. {
  41. id: 2,
  42. label: "Female",
  43. value: "f",
  44. checked: "checked"
  45. }
  46. ],
  47. visible: true
  48. },
  49. {
  50. fieldName: "country",
  51. fieldLabel: "Country",
  52. inputType: "select",
  53. showFieldLabel: true,
  54. empty: "Please select your country of residence",
  55. data: [
  56. {
  57. id: 1,
  58. label: "United States",
  59. value: "us"
  60. },
  61. {
  62. id: 2,
  63. label: "Spain",
  64. value: "es"
  65. }
  66. ],
  67. visible: true
  68. },
  69. {
  70. fieldName: "terms",
  71. fieldLabel: "I accept the terms and conditions <a href=\"\">Some outrageous terms</a>",
  72. inputType: "checkbox",
  73. visible: true,
  74. saveToProfile: false,
  75. validate: function (value, errorFunction) {
  76. if (value) {
  77. return true;
  78. }
  79. else {
  80. errorFunction("You must accept the terms and conditions.");
  81. return false;
  82. }
  83. }
  84. }
  85. ]
  86. });