Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Logging in Users / Sessions / Cookies - Allways logs me out

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 244 Views
  • FlorianGER
    Community Member
    1 Post

    Logging in Users / Sessions / Cookies - Allways logs me out Link to this post

    Hey Guys!

    I got a Problem with an own LogIn Module.


    I have a Controller "MemberHandler_Controller".


    'base': 'MemberHandler_Controller'

    Then i have a AJAX-Form which will LogIn a Member.

    // Login Form
    $("#loginForm").submit(function(event) {
    var email = $("#inputEmail").val();
    var pw = $("#inputPassword").val();
    var remember = $("#rememberLoginInput:checked").length ? "True" : "False";
    url: PreUrl+"base/login",
    data: {email: email, pw: pw, remember: remember},
    dataType: "json",
    type: "POST"
    }).done(function(result) {
    if (result.success) {
    window.location = PreUrl;
    } else {
    $("#loginMessageArea").html(ErrorPreHTML + result.message + ErrorAfterHTML);

    To avoid some stupid Errors i have shrinked the Login Method to that:

    public function Login(SS_HTTPRequest $request) {
    $email = "test@test.com";
    $user = OBUser::get()->find("Email", $email);

    echo json_encode(array("success" => true));

    Now i Press the Login Button at http://localhost/ProjectName/

    It will send an Request to: http://localhost/ProjectName/index.php/base/logout

    Now i get redirected by JavaScript to: http://localhost/ProjectName/index.php

    I can browse the Page now, on every underpage i am logged in like on:

    BUT if i go to a site without the "index.php" like http://localhost/ProjectName/ i am Logged Out...
    if i go back to http://localhost/ProjectName/index.php i am still logged in.

    What is the Problem?

    Very much Thanks in Advance

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.