diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-01-07 08:21:00 -0800 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-01-07 10:20:28 -0800 |
commit | 464f4d3497617fadb9d7752868f1175849cfa6d2 (patch) | |
tree | 0771bd935b30971bf2c244b6f158ed7496b644e5 /apps/um/views/pages/auth | |
parent | 3d64793a1ee45857856be1cd71c3a0a040a3e869 (diff) |
Refactor to separate the framework from the app; drop message stuff, this app is just user management. Add a json view for individual usersHEADmaster
Diffstat (limited to 'apps/um/views/pages/auth')
-rw-r--r-- | apps/um/views/pages/auth/badrequest.html.php | 11 | ||||
-rw-r--r-- | apps/um/views/pages/auth/index.html.php | 12 | ||||
-rw-r--r-- | apps/um/views/pages/auth/login.html.php | 54 | ||||
-rw-r--r-- | apps/um/views/pages/auth/logout.html.php | 6 |
4 files changed, 83 insertions, 0 deletions
diff --git a/apps/um/views/pages/auth/badrequest.html.php b/apps/um/views/pages/auth/badrequest.html.php new file mode 100644 index 0000000..c1fe726 --- /dev/null +++ b/apps/um/views/pages/auth/badrequest.html.php @@ -0,0 +1,11 @@ +<?php global $VARS; +$t = $VARS['template']; + +$t->status('400 Bad Request'); +$t->header('Authentication'); +$t->paragraph('The recieved POST request was malformed/invalid. '. + 'If you got here from a link, this is a bug; '. + 'Let the admin know.'. + 'If you got here from outside, then the API is being '. + 'used incorrectly.'); +$t->footer(); diff --git a/apps/um/views/pages/auth/index.html.php b/apps/um/views/pages/auth/index.html.php new file mode 100644 index 0000000..ac80140 --- /dev/null +++ b/apps/um/views/pages/auth/index.html.php @@ -0,0 +1,12 @@ +<?php global $VARS; +$t = $VARS['template']; +$username = $VARS['username']; + +$t->header('Authentication'); + +$t->openTag('div',array('class'=>'login')); +$t->text("Logged in as ".htmlentities($username).'.'); +$t->logout_button('Logout'); +$t->closeTag('div'); + +$t->footer();
\ No newline at end of file diff --git a/apps/um/views/pages/auth/login.html.php b/apps/um/views/pages/auth/login.html.php new file mode 100644 index 0000000..4e3e0e6 --- /dev/null +++ b/apps/um/views/pages/auth/login.html.php @@ -0,0 +1,54 @@ +<?php global $VARS; +$t = $VARS['template']; +$username = $VARS['username']; +$password = $VARS['password']; + +switch ($VARS['login_code']) { +case 1: $t->status('401 Unauthorized'); break; +case 2: $t->status('404 Not Found'); break; +} + +$t->header('Authentication'); + +$t->openTag('form',array('action'=>$t->url('auth'), 'method'=>"post")); +$t->openFieldset('Login'); +switch ($VARS['login_code']) { +case -1: break; +case 0: + $t->inputP('Successfully logged in as '. + htmlentities($username).'.'); + if (isset($VARS['url'])) { + $url = htmlentities($VARS['url']); + $t->inputP($t->link($url, + 'Return to the page you were on.', + true)); + } + $t->closeFieldset(); + $t->closeTag('form'); + return; + break; +case 1: + $t->inputP("Password does not match username.", + array('class'=>'error')); + break; +case 2: + $t->inputP("Username <q>$username</q> does not exist."); + $username = ''; + break; +} +$t->inputText( 'username', 'Username:', '', $username); +$t->inputPassword('password', 'Password:', '', $password); +$t->openTag('li'); +$t->tag('input', array('type'=>'submit', 'value'=>'Login')); +$t->closeTag('li'); +$t->closeFieldset(); +$t->tag('input', array('type'=>'hidden', + 'name'=>'action', + 'value'=>'login')); +if (isset($VARS['url'])) { + $url = htmlentities($VARS['url']); + $t->tag('input', array('type'=>'hidden', + 'name'=>'url', + 'value'=>$url)); +} +$t->closeTag('form'); diff --git a/apps/um/views/pages/auth/logout.html.php b/apps/um/views/pages/auth/logout.html.php new file mode 100644 index 0000000..2d00998 --- /dev/null +++ b/apps/um/views/pages/auth/logout.html.php @@ -0,0 +1,6 @@ +<?php global $VARS; +$t = $VARS['template']; + +$t->header('Authentication'); +$t->paragraph('Logged out'); +$t->footer(); |