implement 'sesame' auth
This commit is contained in:
@@ -88,6 +88,12 @@
|
||||
<load-on-startup>1</load-on-startup>
|
||||
<async-supported>true</async-supported>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<servlet-name>login</servlet-name>
|
||||
<servlet-class>org.jeudego.pairgoth.web.LoginServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
<async-supported>true</async-supported>
|
||||
</servlet>
|
||||
|
||||
<!-- servlet mappings -->
|
||||
<servlet-mapping>
|
||||
@@ -110,6 +116,10 @@
|
||||
<servlet-name>import</servlet-name>
|
||||
<url-pattern>/api/import/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>login</servlet-name>
|
||||
<url-pattern>/api/login</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- context params -->
|
||||
<context-param>
|
||||
|
@@ -219,7 +219,7 @@ onLoad(() => {
|
||||
break;
|
||||
}
|
||||
case 'ArrowDown': {
|
||||
if (searchResultShown()) {
|
||||
if (typeof(searchResultShown) === 'function' && searchResultShown()) {
|
||||
let lines = $('.result-line');
|
||||
if (typeof (searchHighlight) === 'undefined') searchHighlight = 0;
|
||||
else ++searchHighlight;
|
||||
@@ -230,7 +230,7 @@ onLoad(() => {
|
||||
break;
|
||||
}
|
||||
case 'ArrowUp': {
|
||||
if (searchResultShown()) {
|
||||
if (typeof(searchResultShown) === 'function' && searchResultShown()) {
|
||||
let lines = $('.result-line');
|
||||
if (typeof (searchHighlight) === 'undefined') searchHighlight = 0;
|
||||
else --searchHighlight;
|
||||
@@ -241,10 +241,12 @@ onLoad(() => {
|
||||
break;
|
||||
}
|
||||
case 'Enter': {
|
||||
if (searchResultShown()) {
|
||||
fillPlayer(searchResult[searchHighlight]);
|
||||
} else {
|
||||
$('#register')[0].click();
|
||||
if (typeof(searchResultShown) === 'function') {
|
||||
if (searchResultShown()) {
|
||||
fillPlayer(searchResult[searchHighlight]);
|
||||
} else {
|
||||
$('#register')[0].click();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<div id="login" class="section">
|
||||
<form id="login-form" class="ui form">
|
||||
<form id="login-form" class="ui form" autocomplete="off">
|
||||
<div class="field">
|
||||
<label>Enter the magic word</label>
|
||||
<input type="text" name="sesame"/>
|
||||
<input type="text" name="sesame" autocomplete="false"/>
|
||||
<button type="submit" class="ui green floating button">Log in</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -10,9 +10,9 @@
|
||||
<script type="text/javascript">
|
||||
onLoad(()=>{
|
||||
$('#login-form').on('submit', e => {
|
||||
api.postJson('login', { sesame: $('input[name="sesame"]').val() })
|
||||
api.postJson('login', { sesame: $('input[name="sesame"]')[0].value })
|
||||
.then(resp => {
|
||||
if (resp !== 'error') {
|
||||
if (resp !== 'error' && resp.status === 'ok') {
|
||||
document.location.href = '/index'
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user