Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>(Disclosure: I'm one of the developers of UserApp)</strong></p> <p>If you don't want to roll your own user management, you could try out the third-party service <a href="https://www.userapp.io" rel="nofollow">UserApp</a>, together with the <a href="https://github.com/userapp-io/userapp-angular" rel="nofollow">AngularJS module</a>.</p> <p>Follow the <a href="https://github.com/userapp-io/userapp-angular" rel="nofollow">getting started guide</a>, or take the <a href="http://www.codecademy.com/courses/web-beginner-en-v2b3k" rel="nofollow">course on Codecademy</a>. Here's some examples of how it works:</p> <ul> <li><p><strong>Login form with error handling:</strong></p> <pre><code>&lt;form ua-login ua-error="error-msg"&gt; &lt;input name="login" placeholder="Username"&gt;&lt;br&gt; &lt;input name="password" placeholder="Password" type="password"&gt;&lt;br&gt; &lt;button type="submit"&gt;Log in&lt;/button&gt; &lt;p id="error-msg"&gt;&lt;/p&gt; &lt;/form&gt; </code></pre></li> <li><p><strong>Signup form with error handling:</strong></p> <pre><code>&lt;form ua-signup ua-error="error-msg"&gt; &lt;input name="first_name" placeholder="Your name"&gt;&lt;br&gt; &lt;input name="login" ua-is-email placeholder="Email"&gt;&lt;br&gt; &lt;input name="password" placeholder="Password" type="password"&gt;&lt;br&gt; &lt;button type="submit"&gt;Create account&lt;/button&gt; &lt;p id="error-msg"&gt;&lt;/p&gt; &lt;/form&gt; </code></pre> <p><code>ua-is-email</code> means that the username is the same as the email.</p></li> <li><p><strong>How to specify which routes that should be public, and which route that is the login form:</strong></p> <pre><code>$routeProvider.when('/login', {templateUrl: 'partials/login.html', public: true, login: true}); $routeProvider.when('/signup', {templateUrl: 'partials/signup.html', public: true}); </code></pre> <p>The <code>.otherwise()</code> route should be set to where you want your users to be redirected after login. Example:</p> <p><code>$routeProvider.otherwise({redirectTo: '/home'});</code></p></li> <li><p><strong>Log out link:</strong></p> <p><code>&lt;a href="#" ua-logout&gt;Log Out&lt;/a&gt;</code></p></li> <li><p><strong>Access user properties:</strong></p> <p>User info is accessed using the <code>user</code> service, e.g: <code>user.current.email</code></p> <p>Or in the template: <code>&lt;span&gt;{{ user.email }}&lt;/span&gt;</code></p></li> <li><p><strong>Hide elements that should only be visible when logged in:</strong></p> <p><code>&lt;div ng-show="user.authorized"&gt;Welcome {{ user.first_name }}!&lt;/div&gt;</code></p></li> <li><p><strong>Show an element based on permissions:</strong></p> <p><code>&lt;div ua-has-permission="admin"&gt;You are an admin&lt;/div&gt;</code></p></li> </ul> <p>And to authenticate to your back-end services, just use <code>user.token()</code> to get the session token and send it with the AJAX request. At the back-end, use the <a href="https://app.userapp.io/#/docs/" rel="nofollow">UserApp API</a> to check if the token is valid or not. We're also working on a Python library.</p> <p>If you need any help, just let me know :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload