Important:
This support area is for Kalium 3 users only. Support for Kalium 4 has moved to our new platform at support.laborator.co. If you’re using Kalium 4, please create a new account there using your email and license key. A password will be sent to you automatically.

Okay
  Public Ticket #1724256
form submition
Closed

Comments

  • Infinitywebsolution started the conversation

    in log in form ng-submit or ng-click are not working

    #login.html

    <form method="post" role="form" id="login" class="login-form fade-in-effect">

                    <div class="login-header">
                        <a href="#/app/dashboard-variant-1" class="logo">
                            <img src="assets/images/[email protected]" alt="" width="80" />
                            <span>log in</span>
                        </a>

                        <p>Dear user, log in to access the admin area!</p>
                    </div>

                    <div class="form-group">
                        <label class="control-label" for="username">Username</label>
                        <input type="text" class="form-control input-dark" name="username" id="username" autocomplete="off" ng-model="LoginCtrl.inputData.username" />
                    </div>

                    <div class="form-group">
                        <label class="control-label" for="passwd">Password</label>
                        <input type="password" class="form-control input-dark" name="passwd" id="passwd" autocomplete="off" ng-model="LoginCtrl.inputData.password" />
                    </div>
                     <div class="alert alert-danger" ng-show="errorMsg">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">
                            ×</button>
                            <span class="glyphicon glyphicon-hand-right"></span>  {{errorMsg}}
                      </div>
                    <div class="form-group">
                        <button type="submit" class="btn btn-dark  btn-block text-left" ng-click="LoginCtrl.postForm(this.form)">
                            <i class="fa-lock"></i>
                            Log In
                        </button>
                    </div>

                    <div class="login-footer">
                        <a href="">Forgot your password?</a>

                        <div class="info-links">
                            <a href="">ToS</a> -
                            <a href="">Privacy Policy</a>
                        </div>

                    </div>

                </form>

    #controller

    controller('LoginCtrl',function($scope, $rootScope,$http)
        {
            $rootScope.isLoginPage        = true;
            $rootScope.isLightLoginPage   = false;
            $rootScope.isLockscreenPage   = false;
            $rootScope.isMainPage         = false;

            this.postForm = function() {
                
                    var encodedString = 'username=' +
                        encodeURIComponent(this.inputData.username) +
                        '&password=' +
                        encodeURIComponent(this.inputData.password);
     
                    $http({
                        method: 'POST',
                        url: 'userauth.php',
                        data: encodedString,
       
                    })
                    
                    .success(function(data) {
                            console.log(data);
                            if ( data.trim() === 'correct') {
                                window.location.hash = '#/app/dashboard-variant-1';
                            } else {
                                $scope.errorMsg = "Username and password do not match.";
                            }
                    })             }

        })

    #userauth.php

    <?php

        $username = $_POST['username'];
        $password = $_POST['password'];

        if ($username == "supriyo" && $password == "abc@123") {

            echo "correct";
        }
        else{

            echo "wrong";
        }
     ?>

    this methos are not working

  • [deleted] replied

    Hi,

    On login verification you should simply change the hash url:

    window.location.hash = '#/app/dashboard-variant-1';

    To your dashboard or whenever you want URL route to show in angular version. This is how it works in our side:

    https://themes.laborator.co/xenon/angular/#/login

    Entering demo/demo will pass the login and it will simply redirect using the above code. Note that further login verification is not made when you access other pages because this is demo website, this should be handled by you.