mirror of
https://github.com/zhigang1992/deployd.git
synced 2026-05-24 05:47:45 +08:00
37 lines
714 B
Plaintext
37 lines
714 B
Plaintext
<div id="login-form">
|
|
Username
|
|
<input id="uid" type="text" />
|
|
Password
|
|
<input id="password" type="password" />
|
|
<button id="login">login</button>
|
|
</div>
|
|
|
|
<script>
|
|
|
|
d('/me', function(res) {
|
|
if(res && res.uid)
|
|
$('#login-form').html('Logged in as ' + res.uid);
|
|
})
|
|
|
|
$('#login').click(function() {
|
|
var info = {
|
|
email: $('#uid').val(),
|
|
password: $('#password').val()
|
|
};
|
|
|
|
d('/user/login', info, function(res) {
|
|
if(res.auth) {
|
|
window.location = '/my/apps';
|
|
} else {
|
|
alert('login failed...');
|
|
}
|
|
});
|
|
});
|
|
|
|
$('#logout').click(function() {
|
|
d('/user/logout', function() {
|
|
window.location.reload();
|
|
});
|
|
})
|
|
|
|
</script> |