Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
titleDefault action after login
/**
 * Page shown after login
 * 
 * @param info Session info from /info API call
 */
Ceptor.afterLoginPage = function(info) {
    $(locationName).html(var text =
		'<p class="marginTop 25px">'+
		'<img class="asseco-logo" src="icon/Assecologo.png">'+
		'<img class="ceptor-logo" src="icon/Ceptorlogo.png">'+
        '<div id="login-result" class="row">'+
		'        <div class="blue-text center">'+
        '            <h3 class="center">Welcome</h3>'+
        '           <div class="black-text center">'+
        '              <h5>Hello '+$('<div>').text(info.user_name).html()+'</h5>'+
        '           </div>'+
        '        </div>'+
        '</div>'+
        '<div class="card-panel">'+;

    if (!availableOTPMethods.includes("totp")) {
  '     <span class= text +=
        '     <span class="blue-text text-darken-2"><h6>Please go to <a href="https://ceptor.io">ceptor.io</a> for more information about Ceptor<><h6><a onclick="document.Ceptor.registerTOTPPage()">Register Authenticator App</a></h6></span>';
    }

    text +=
        '     <span class="blue-text text-darken-2"><h6><a href="/docs/4.0/examples/dashboard/">View company site</a></h6></span>'+
        '     <span class="blue-text text-darken-2"><h6><a href="/docs/4.0/examples/blog/">View intranet</a></h6></span>'+
        '     <span class="blue-text text-darken-2"><h6><a href="/">Internal mail</a></h6></span>'+
        '</div>'+
        '<div class="fixed-action-btn">'+
        '    <a class="btn-floating btn-large red pulse">'+
        '        <i class="large material-icons">menu</i>'+
        '    </a>'+
        '    <ul>'+
        '        <li><a class="btn-floating blue" onclick="document.Ceptor.registerTOTPPage()"><i class="material-icons">person</i></a></li>'+
        '        <li><a class="btn-floating yellow darken-1" onclick="document.Ceptor.logoff()"><i class="material-icons">exit_to_app</i></a></li>'+
        '    </ul>'+
        '</div>';

    $(locationName).html(text);


    var elems = document.querySelectorAll('.fixed-action-btn');
    M.FloatingActionButton.init(elems, {});
}


Here, change to your preferred action - if you e.g. you can redirect to / after login by changing to:

...

Code Block
languagejs
titleMore complete example with menu after login
Ceptor.afterLoginPage = function(info) {
    var text =
		'<p class="marginTop 25px">'+
		'<img class="asseco-logo" src="icon/Assecologo.png">'+
		'<img class="ceptor-logo" src="icon/Ceptorlogo.png">'+
        '<div id="login-result" class="row">'+
		'        <div class="blue-text center">'+
        '            <h3 class="center">Welcome</h3>'+
        '           <div class="black-text center">'+
        '              <h5>Hello '+$('<div>').text(info.user_name).html()+'</h5>'+
        '           </div>'+
        '        </div>'+
        '</div>'+
        '<div class="card-panel">';

    if (!availableOTPMethods.includes("totp")) {
        text +=
        '     <span class="blue-text text-darken-2"><h6><a onclick="document.Ceptor.registerTOTPPage()">Register Authenticator App</a></h6></span>';
    }

    text +=
        '     <span class="blue-text text-darken-2"><h6><a href="/">View company inventory page</a></h6></span>'+
        '     <span class="blue-text text-darken-2"><h6><a href="/intranet">View intranet</a></h6></span>'+
        '     <span class="blue-text text-darken-2"><h6><a href="/email">Internal mail</a></h6></span>'+
        '</div>'+
        '<div class="fixed-action-btn">'+
        '    <a class="btn-floating btn-large red pulse">'+
        '        <i class="large material-icons">menu</i>'+
        '    </a>'+
        '    <ul>'+
        '        <li><a class="btn-floating blue" onclick="document.Ceptor.registerTOTPPage()"><i class="material-icons">person</i></a></li>'+
        '        <li><a class="btn-floating yellow darken-1" onclick="document.Ceptor.logoff()"><i class="material-icons">exit_to_app</i></a></li>'+
        '    </ul>'+
        '</div>';

    $(locationName).html(text);

    var elems = document.querySelectorAll('.fixed-action-btn');
    M.FloatingActionButton.init(elems, {});
}

...