GithubHelp home page GithubHelp logo

apostrophecms / apostrophe-signup Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 5.0 19 KB

Lets the public sign up for accounts on a website powered by apostrophecms.

JavaScript 87.46% HTML 10.13% Less 2.41%

apostrophe-signup's Introduction

apostrophe-signup

npm install apostrophe-signup
// in app.js
modules: {
  'apostrophe-signup': {
    // How long a signup email remains valid
    hours: 48,     
    // Apostophe group newly signed-up users are added to,
    // with optional permissions
    group: {
      title: 'signup',
      // Let them create apostrophe blog posts (which would need
      // to be a module enabled in your project) and upload files
      // to attach to them
      permissions: [ 'edit-apostrophe-blog', 'edit-attachment' ]
    },
    // defaults
    signupUrl: '/signup',
    signupConfirmUrl: '/signup-confirm',
    afterSignupUrl: '/',
    // Allow the user to enter a subset of the
    // fields in your `apostrophe-users` schema as
    // they are signing up. These are the defaults.

    // They will always be asked for their email address
    // and password. If you leave `username` off this list,
    // the user can only log in with their email address.
    fields: [ 'firstName', 'lastName', 'username' ],
    // Allow the user to enter a subset of the fields to be 
    // converted into required ones. By default only password
    // field is been converted to a required field.
    requiredFields: [ 'password' ]
  },

  // The apostrophe-email module must be configured
  'apostrophe-email': {
    // See the nodemailer documentation, many
    // different transports are available, this one
    // matches how PHP does it on Linux servers
    nodemailer: {
      sendmail: true,
      newline: 'unix',
      path: '/usr/sbin/sendmail'
    }
  }
}

Lets the public sign up for accounts. The user must receive an email at a unique address and confirm their account.

The apostrophe-email module must be configured. See sending email from your Apostrophe project.

Signing up

Try going to /signup.

Overriding and styling the signup page

You may override the views/signup.html template of this module by copying it to lib/modules/apostrophe-signup/views in your own project. As always, do not edit the copy in node_modules.

You may output the signup form markup yourself, but each input element must be nested in a "fieldset" element, which need not be of that type but must have the right data-name attribute. Inspect the standard markup to see what this looks like. Tolerance for changes of this kind varies from schema field type to schema field type.

Overriding the signup confirmation email

Copy views/signupEmail.html from this module to the lib/modules/apostrophe-signup/views/signupEmail.html folder of your own project. As usual, HTML in email is extremely limited, so keep your expectations basic. This has nothing to do with Apostrophe and everything to do with email clients.

If confirmation emails do not arrive

You need a better nodemailer configuration. The example configuration above assumes sendmail, postfix or a similar service is installed on your server and well-configured for reliable delivery. For best results, configure nodemailer to send mail via a legitimate account or, for higher volumes, via a trusted transactional email service like Postmark or Amazon Simple Email Service. For more information see sending email from your Apostrophe project.

If the signup form yields an error

As the message shown to the user says, this may be as simple as a duplicate email address or username. That is the most common reason.

However if this always occurs your nodemailer configuration might not be working at all. Review the server console error messages, and see above.

Giving the user special attention after signup

You can set the afterSignupUrl option to any URL you wish.

In addition, req.session.signup is set to true for the duration of the user's first session. You can detect this in middleware, pageBeforeSend, et cetera.

apostrophe-signup's People

Contributors

abea avatar boutell avatar jose96git avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

apostrophe-signup's Issues

Error on clean install

Installed apostrophe-signup, cut and pasted app.js configuration - but crashed immediately with the following error:

node_modules/apostrophe-signup/index.js:27
self.apos.users.addSecret('signupConfirm');
^

TypeError: self.apos.users.addSecret is not a function

How to redirect user to confirm email page if email sending failed

Hi,

How can I change the default behaviour of showing same error message for duplicate email and verification email send failed.

The error message That username or email address may be in use. Please review and try again. is confusing.

If email sending fails I want to redirect user to confirm email page where user can input email and can receive confirmation email again.

Join fields can't be added to the signup form

Hi, I've tried to add some fields with joinByOne or joinByArray types and when I load the signup page, the browser show me some errors in its console. And those buttons are not working. Is this maybe an issue to fix?

I'll attach an image with the browser error and also a simple project that reflects this.

This is not related with the issue, but I also noticed that there's no a require of lodash, and it's necessary to do the password shallow copy.

Thanks!

image
test-signup-project.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.