menu

SiteGenesis / Server-side JS / Module: controllers/Login

Controller for all customer login storefront processes.

Source:

Members

(static) LoginForm

Determines whether the request has an OAuth provider set.

Source:
See:

(static) Logout

Contains the login page preparation and display.

Source:
See:

(static) OAuthLoginForm

Form handler for the oauthlogin form.

Source:
See:

(static) OAuthReentry

Exchanges a user authentication code for a token and requests user information from an OAUTH provider.

Source:
See:

(static) OAuthReentryFacebook

Deprecated:
Source:

(static) OAuthReentryGitHub

Deprecated:
Source:

(static) OAuthReentryGoogle

Deprecated:
Source:

(static) OAuthReentryGooglePlus

Deprecated:
Source:

(static) OAuthReentryLinkedIn

Deprecated:
Source:

(static) OAuthReentryMicrosoft

Deprecated:
Source:

(static) OAuthReentrySinaWeibo

Deprecated:
Source:

(static) OAuthReentryVKontakte

Deprecated:
Source:

(static) Show

Contains the login page preparation and display.

Source:
See:

Methods

(inner) finishOAuthLogin()

Internal helper function to finish the OAuth login. Redirects user to the location set in either the handleOAuthLoginForm function

Source:

(inner) getSinaWeiboAccountInfo(accessToken, userId) → {Object}

Get Sina Weibo account via additional requests. Also handles multiple error conditions and logs them.

Parameters:
Name Type Description
accessToken String

The OAuth access token.

userId String

The OAuth user ID.

Source:
To Do:
  • Migrate httpClient calls to dw.svc.*
Returns:

Account information.

Type
Object

(inner) getTargetUrl() → {dw.web.Url}

Internal function that reads the URL that should be redirected to after successful login

Source:
Returns:

The URL to redirect to in case of success or Account controller Show function in case of failure.

Type
dw.web.Url

(inner) handleLoginForm()

Form handler for the login form. Handles the following actions:

  • login - logs the customer in and renders the login page. If login fails, clears the login form and redirects to the original controller that triggered the login process.
  • register - redirects to the Account controller StartRegister function
  • findorder - if the ordertrack form does not contain order number, email, or postal code information, redirects to Login controller Show function. If the order information exists, searches for the order using that information. If the order cannot be found, renders the LoginView. Otherwise, renders the order details page (account/orderhistory/orderdetails template).
  • error - renders the LoginView.
Source:

(inner) handleOAuthLoginForm()

Form handler for the oauthlogin form. Handles the following actions:

  • login - Starts the process of authentication via an external OAuth2 provider. Uses the OAuthProvider property in the httpParameterMap to determine which provider to initiate authentication with. Redirects to the provider web page where the customer initiates the actual user authentication. If no provider page is available, renders the LoginView.
  • error - renders the LoginView.
Source:

(inner) handleOAuthReentry()

This function is called after authentication by an external oauth provider. If the user is successfully authenticated, the provider returns an authentication code, this function exchanges the code for a token and with that token requests the user information specified by the configured scope (id, first/last name, email, etc.) from the provider. If the token exchange succeeds, calls the oAuthSuccess function. If the token exchange fails, calls the oAuthFailed function. The function also handles multiple error conditions and logs them.

Source:

(inner) Logout()

Logs the customer out and clears the login and profile forms. Calls the Account controller Show function.

Source:

(inner) oAuthFailed()

Invalidates the oauthlogin form. Calls the finishOAuthLogin function.

Source:

(inner) oAuthSuccess()

Clears the oauthlogin form. Calls the finishOAuthLogin function.

Source:

(inner) processLoginForm()

Determines whether the request has an OAuth provider set. If it does, calls the handleOAuthLoginForm function, if not, calls the handleLoginForm function.

Source:

(inner) show()

Contains the login page preparation and display, it is called from various places implicitly when 'loggedIn' is ensured via the module:guard.

Source: