[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [ocs-server] plasmastore: added login form model and controller
From:       Francesco Wofford <francescowofford () gmail ! com>
Date:       2015-05-31 16:10:31
Message-ID: E1Yz5ol-0006OC-26 () scm ! kde ! org
[Download RAW message or body]

Git commit ad6f8ff6522e60985dbcd355bde187129ab16268 by Francesco Wofford.
Committed on 31/05/2015 at 16:10.
Pushed by francescowofford into branch 'master'.

added login form model and controller

A  +17   -0    plasmastore/controllers/login.controller.php
C  +1    -0    plasmastore/controllers/login.controller.php.ignore [from: \
plasmastore/views/login.views.php - 098% similarity] A  +19   -0    plasmastore/models/login.model.php
M  +1    -1    plasmastore/views/login.views.php

http://commits.kde.org/ocs-server/ad6f8ff6522e60985dbcd355bde187129ab16268

diff --git a/plasmastore/controllers/login.controller.php b/plasmastore/controllers/login.controller.php
new file mode 100644
index 0000000..e95cdf7
--- /dev/null
+++ b/plasmastore/controllers/login.controller.php
@@ -0,0 +1,17 @@
+<?php
+class LoginController extends EController {
+	public function login(){ 
+        $loginModel = new LoginModel();
+        $login = EHeaderDataParser::db_post("login");
+    	$password = EHeaderDataParser::db_post("password");
+    
+    if($loginModel->login($login, $password)){
+        header("Location: $prevpage?e=Logged!");
+        } else {
+    header("Location: $prevpage?e=Error!");
+    }
+        
+    }
+
+	}
+?>
diff --git a/plasmastore/views/login.views.php b/plasmastore/controllers/login.controller.php.ignore
similarity index 98%
copy from plasmastore/views/login.views.php
copy to plasmastore/controllers/login.controller.php.ignore
index 15ecbb8..c1b71d9 100644
--- a/plasmastore/views/login.views.php
+++ b/plasmastore/controllers/login.controller.php.ignore
@@ -20,4 +20,5 @@
           </ul>
           </li>
           </ul>";}
+          }
           ?> 
diff --git a/plasmastore/models/login.model.php b/plasmastore/models/login.model.php
new file mode 100644
index 0000000..3c8110b
--- /dev/null
+++ b/plasmastore/models/login.model.php
@@ -0,0 +1,19 @@
+<?php
+class LoginModel extends EModel {
+    
+    public function login($nick, $pass){
+    $postdata = array(
+        "login" => $login,
+        "password" => $password
+        );
+    $client = new OCSClient(EConfig::$data["ocs"]["host"]);
+    $check = $client->post("v1/person/check",$postdata);
+    //ELog::pd($client->get_last_raw_result());
+    if($check["ocs"]["meta"]["statuscode"]=="100"){
+        EUser::login($login,$password);
+        return true;
+} else {
+    return false;
+}
+}
+}
\ No newline at end of file
diff --git a/plasmastore/views/login.views.php b/plasmastore/views/login.views.php
index 15ecbb8..132e12d 100644
--- a/plasmastore/views/login.views.php
+++ b/plasmastore/views/login.views.php
@@ -1,7 +1,7 @@
 <?php
 
  if(!EUser::logged()){ echo "
-      <form class=\"navbar-form navbar-right\">
+      <form class=\"navbar-form navbar-right\ action=\"/plasmastore/user/login\" method=\"post\">
         <div class=\"form-group\">
             <input type=\"text\" class=\"form-control\" name=\"username\" placeholder=\"Username\"> 
             <input type=\"text\" class=\"form-control\" name=\"password\" placeholder=\"Password\">


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic