disallow correspondence seeks to anon players

This commit is contained in:
Thibault Duplessis 2014-12-19 02:30:18 +01:00
parent eab6a75544
commit ab276bc0cb
3 changed files with 15 additions and 6 deletions

View file

@ -1,6 +1,7 @@
@(form: Form[_], typ: String, title: Html, route: Call, fields: Html, error: Option[Html] = None)(implicit ctx: Context)
<div class="lichess_overboard game_config game_config_@typ">
<div class="lichess_overboard game_config game_config_@typ"
@if(ctx.isAnon){data-anon="1"}>
<a href="@routes.Lobby.home" class="close icon" title="@trans.cancel()" data-icon="L"></a>
<h2>@title</h2>
@error.map { e =>

View file

@ -1,8 +1,10 @@
@(field: play.api.data.Field, options: Seq[(String,String, Option[String])])
@(field: play.api.data.Field, options: Seq[(String, String, Option[String])])
<select id="@field.id" name="@field.name">
@options.map { v =>
<option value="@v._1" class="@{field.name}_@v._1" @v._3.map { title =>
title="@title"
} @if(field.value.contains(v._1)){selected="selected"}>@v._2</option>
@options.map {
case (value, name, title) => {
<option value="@value" class="@{field.name}_@value" @title.map { t =>
title="@t"
} @if(field.value.contains(value)){selected="selected"}>@name</option>
}
}
</select>

View file

@ -1290,6 +1290,12 @@ var storage = {
};
if (isHook) {
var $formTag = $form.find('form');
if ($form.data('anon')) {
$timeModeSelect.val(1)
.children('.timeMode_2, .timeMode_0')
.prop('disabled', true)
.attr('title', $.trans('You need an account to do that'));
}
var ajaxSubmit = function(color) {
$.ajax({
url: $formTag.attr('action').replace(/uid-placeholder/, lichess.StrongSocket.sri),