menu

SiteGenesis / Server-side JS / Source: app_storefront_controllers/cartridge/scripts/views/LoginView.js

'use strict';
/**
 * This view provides rendering methods for login templates.
 * @module views/LoginView
 */

var View = require('./View');
/**
 * Helper class for rendering login functionality.
 * @class module:views/LoginView~LoginView
 * @extends module:views/View
 * @lends module:views/LoginView~LoginView.prototype
*/
var LoginView = View.extend({
    // does not work, hence workaround via init()
    //ContinueURL : dw.web.URLUtils.https('Login-LoginForm'),
    template: 'account/login/accountlogin',

    /**
     * View for login functionality.
     *
     * @constructs module:views/LoginView~LoginView
     * @param {Object} params The parameters to pass to the template.
     */
    init: function (params) {
        this._super(params);
        this.ContinueURL = dw.web.URLUtils.https('Login-LoginForm');

        if (request.httpParameterMap.scope) {
            this.ContinueURL = this.ContinueURL.append('scope', request.httpParameterMap.scope.value);

            switch (request.httpParameterMap.scope.value) {
                case 'wishlist' :
                    this.template = 'account/wishlist/wishlistlanding';
                    break;
                case 'giftregistry' :
                    this.template = 'account/giftregistry/giftregistrylanding';
                    break;
                case 'checkout' :
                    this.template = 'checkout/checkoutlogin';
                    break;
                default:
            }
        }
    }

});

module.exports = LoginView;

X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.