Code Monkey home page Code Monkey logo

aa_app_mod_auth's Introduction

App-Arena.com App Module: Auth

Required Template-Version: >= 1.3.0

Module job

Shows login and register page/modal, handle navigation view for logout/login/avatar/admin information and a password lost and request new function. The login process can be used over mail and social networks.

Functions

  • share - Shares information from a button.

Dependencies

  • twitter
  • facebook
  • google
  • logging
  • notification

Important functions in LoginView

  • addRedirection - defines a redirection url that is called after successfully login (not required)
    • redirection - redirection url (default: '' for root)
  • renderPage - shows a single content page with a login and register form
  • renderModal - shows a modal with a login and register form
  • openModal - Opened a rendered login modal. This is automatically called from renderModal
  • handleNavigation - shows or hide login button and profile links, avatar and admin button

Page urls

  • /#/mod/static/auth
  • /#/mod/static/auth/modal
  • /#/mod/static/auth/demo-register
  • /#/mod/static/auth/demo-register-modal
  • /#/mod/auth/password
  • /#/mod/auth/password/[SECRET-ID]

Examples

login process on single page

require(['modules/aa_app_mod_auth/js/views/LoginView'], function (LoginView) {
    LoginView().init().render().renderPage();
});

login process on modal

require(['modules/aa_app_mod_auth/js/views/LoginView'], function (LoginView) {
    LoginView().init().render().renderModal();
});

register process on single page with login check

require(['modules/aa_app_mod_auth/js/views/LoginView'], function (LoginView) {
    LoginView().init().render().addRedirection('page/auth/demo-register/userdata').renderPage();
});

register process on modal with login check

require(['modules/aa_app_mod_auth/js/views/LoginView'], function (LoginView) {
    LoginView().init().render().addRedirection('page/auth/demo-register/userdata').renderModal();
});

userdata form

require([
    'modules/aa_app_mod_auth/js/views/UserDataView',
    'modules/aa_app_mod_auth/js/views/LoginView'
], function (UserDataView, LoginView) {
    var loginView = LoginView().init(),
        element = $('.content-wrapper'),
        userDataView = UserDataView().init({
            attributes: {
                model: loginView.loginModel
            }
        });
    userDataView.modifyElement(element).defineUserInformation(function () {
        if (userDataView.status === 'needUserdata') {
            // show userdata page
            userDataView.renderPage();
        } else {
            // all userdata exist, redirect to startpage
            _.router.navigate('', {trigger: true});
        }
    });
});

password lost form

require(['modules/aa_app_mod_auth/js/views/PasswordLostView'], function (PasswordLostView) {
    PasswordLostView().init({'init': true}).render();
});

set new password after password lost request

// the secret ID was send by URL as parameter
id = id || 0;
require(['modules/aa_app_mod_auth/js/views/PasswordGetNewView'], function (PasswordGetNewView) {
    PasswordGetNewView().init({
        'init': true,

        'attributes': {
            secret: id
        }
    }).render();
});

Load module with require

// login
modules/aa_app_mod_auth/js/views/LoginView

// userdata
modules/aa_app_mod_auth/js/views/UserDataView

// password lost request
modules/aa_app_mod_auth/js/views/PasswordLostView

// set new password
modules/aa_app_mod_auth/js/views/PasswordGetNewView

App-Manager config values

config default description
login_social_networks ["fb", "twitter", "gplus", "email_password" ] multiselect to enable/disable login types
admin_mails empty admin e-mail addies (with commata) to set app admins
mod_participate_userdata ["gender","name","birthday","address","field1","field2","field3"] multiselect
mod_participate_userdata_requirements ["name","birthday","address","field1","field2","field3"] multiselect
mail_activated checkbox ย 

App-Manager locale values

locale value example
login_headline Sign up
msg_require_mail An E-Mail address is required.
msg_require_mail_format The E-Mail needs to be in the format of [email protected]
msg_require_password A new password is required
msg_require_password_format The password must be at least (0) characters long
msg_require_password_again Needs to have the same content as the password
msg_login_wrongdata_title Log in not possible
msg_login_wrongdata_description Data does not match or the account does not exist.
msg_login_user_exists_title Error
msg_login_user_exists_description Account already exists
msg_mail_pwgetnew_title_error Error
msg_mail_pwgetnew_desc_error The password couldn't be changed. Please contact the admin.
msg_mail_pwgetnew_title_success Congratulations
msg_mail_pwgetnew_desc_success Password was saved successfully.
msg_mail_pwlost_title_success Password sent.
msg_mail_pwlost_title_error Error
msg_mail_pwlost_desc_error A new password could't be sent
msg_mail_pwlost_desc_success Please check your inbox
msg_require_firstname Please enter your first name
msg_require_lastname Please enter your last name
msg_require_birthday Please fill in your date of birth
msg_require_street Please fill in street name
msg_require_zip Please enter your Zip code
msg_require_city Please fill in your city
msg_require_field1 Please fill in
msg_require_field2 Please fill in
msg_require_field3 Please fill in
msg_require_terms Please accept the conditions of participation

aa_app_mod_auth's People

Contributors

mmerchel avatar

Watchers

Sebastian Buckpesch avatar Valentin Klein avatar  avatar James Cloos avatar frd avatar  avatar  avatar Kristijan Risteski avatar  avatar  avatar Marius Brandt avatar  avatar

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.