The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
Login validation with Android App - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.4 (https://userspice.com/forums/forumdisplay.php?fid=27)
+--- Thread: Login validation with Android App (/showthread.php?tid=1416)



Login validation with Android App - daveyc - 04-01-2019

Hi guys,

I'm new to userspice and have been building an IOT platform using the system. Its coming together well. I now need to allow login from an android app to the platform.

At the moment, I'm just trying to send a validation message that the user and password are correct. I've tried using POST to send the data to the login form but I am not getting any response. When I try it in Postman, I get an error page with the message:

"There was an error with your form. Please go back and try again. Please note that submitting the form by refreshing the page will cause an error."

Am I going about this the wrong way?


RE: Login validation with Android App - daveyc - 04-02-2019

I solved the problem. I just learned how the login.php file worked and made a second login file just for the smartphone app.

Code:
<?php

// This is a user-facing page
//This page has been written to allow the app to login to the website

$uname=$_POST["username"];
$pword=$_POST["password"];
ini_set("allow_url_fopen", 1);
if(isset($_SESSION)){session_destroy();}
require_once '../users/init.php';


$validate = new Validate();
$user = new User();
$remember=true;
$login = $user->loginEmail($uname, trim($pword), $remember);



if ($login) {
    echo "Valid username and password provided. ";
    // Do actions for smartphone app

}

else {
        echo "Validation failure.";
      }

?>



RE: Login validation with Android App - mudmin - 04-02-2019

Is everything working properly? If you need help making that api, let me know. Sorry I wasn't on the forums yesterday.