index.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. {% extends '../layout/2column.html' %}
  2. {% block html_title %}{{ t('User Settings') }} · {{ path }}{% endblock %}
  3. {% block content_head %}
  4. <div class="header-wrap">
  5. <header id="page-header">
  6. <h1 class="title" id="">{{ t('User Settings') }}</h1>
  7. </header>
  8. </div>
  9. {% endblock %}
  10. {% block content_main %}
  11. <div class="content-main">
  12. <ul class="nav nav-tabs">
  13. <li class="active"><a href="/me"><i class="fa fa-gears"></i> {{ t('User Information') }}</a></li>
  14. <li><a href="/me/external-accounts"><i class="fa fa-user-plus"></i> {{ t('External Accounts') }}</a></li>
  15. <li><a href="/me/password"><i class="fa fa-key"></i> {{ t('Password Settings') }}</a></li>
  16. <li><a href="/me/apiToken"><i class="fa fa-rocket"></i> {{ t('API Settings') }}</a></li>
  17. </ul>
  18. <div class="tab-content">
  19. {% set smessage = req.flash('successMessage') %}
  20. {% if smessage.length %}
  21. <div class="alert alert-success">
  22. {{ smessage }}
  23. </div>
  24. {% endif %}
  25. {% set wmessage = req.flash('warningMessage') %}
  26. {% if wmessage.length %}
  27. <div class="alert alert-danger">
  28. {{ wmessage }}
  29. </div>
  30. {% endif %}
  31. {% if req.form.errors.length > 0 %}
  32. <div class="alert alert-danger">
  33. <ul>
  34. {% for error in req.form.errors %}
  35. <li>{{ error }}</li>
  36. {% endfor %}
  37. </ul>
  38. </div>
  39. {% endif %}
  40. <div class="form-box">
  41. <form action="/me" method="post" class="form-horizontal" role="form">
  42. <fieldset>
  43. <legend>{{ t('Basic Info') }}</legend>
  44. <div class="form-group">
  45. <label for="userForm[name]" class="col-sm-2 control-label">{{ t('Name') }}</label>
  46. <div class="col-sm-4">
  47. <input class="form-control" type="text" name="userForm[name]" value="{{ user.name }}" required>
  48. </div>
  49. </div>
  50. <div class="form-group">
  51. <label for="userForm[email]" class="col-sm-2 control-label">{{ t('Email') }}</label>
  52. <div class="col-sm-4">
  53. <input class="form-control" type="email" name="userForm[email]" value="{{ user.email }}">
  54. </div>
  55. <div class="col-sm-offset-2 col-sm-10">
  56. {% if config.crowi['security:registrationWhiteList'] && config.crowi['security:registrationWhiteList'].length %}
  57. <p class="help-block">
  58. {{ t('page_register.form_help.email') }}
  59. <ul>
  60. {% for em in config.crowi['security:registrationWhiteList'] %}
  61. <li><code>{{ em }}</code></li>
  62. {% endfor %}
  63. </ul>
  64. </p>
  65. {% endif %}
  66. </div>
  67. </div>
  68. <div class="form-group {% if not user.emailpublished %}has-error{% endif %}">
  69. <label for="userForm[emailPublished]" class="col-sm-2 control-label">{{ t('Disclose E-mail') }}</label>
  70. <div class="col-sm-4">
  71. <label class="radio-inline"><input type="radio" name="userForm[emailPublished]" value="{{ consts.emailPublished }}" {% if user.emailPublished == consts.emailpublished %}checked="checked"{% endif %}>{{ t('Show') }}</label>
  72. <label class="radio-inline"><input type="radio" name="userForm[emailPublished]" value="{{ consts.emailPublished }}" {% if user.emailPublished == consts.emailpublished %}checked="checked"{% endif %}>{{ t('Hide') }}</label>
  73. </div>
  74. </div>
  75. <div class="form-group {% if not user.lang %}has-error{% endif %}">
  76. <label for="userForm[lang]" class="col-sm-2 control-label">{{ t('Language') }}</label>
  77. <div class="col-sm-4">
  78. <label class="radio-inline"><input type="radio" name="userForm[lang]" value="{{ consts.language.LANG_EN_US }}" {% if user.lang == consts.language.LANG_EN_US %}checked="checked"{% endif %}>{{ t('English') }}</label>
  79. <label class="radio-inline"><input type="radio" name="userForm[lang]" value="{{ consts.language.LANG_JA }}" {% if user.lang == consts.language.LANG_JA %}checked="checked"{% endif %}>{{ t('Japanese') }}</label>
  80. </div>
  81. </div>
  82. <div class="form-group">
  83. <div class="col-sm-offset-2 col-sm-10">
  84. <button type="submit" class="btn btn-primary">{{ t('Update') }}</button>
  85. </div>
  86. </div>
  87. </fieldset>
  88. </form>
  89. </div>
  90. <div class="form-box">
  91. <!-- separeted form tag -->
  92. <form action="/me/imagetype" id="formImageType" method="post" class="form" role="form"></form>
  93. <fieldset>
  94. <legend>{{ t('Set Profile Image') }}</legend>
  95. <div class="form-group col-sm-offset-1 col-sm-3">
  96. <div class="radio">
  97. <h4>
  98. <input type="radio" form="formImageType" name="imagetypeForm[isGravatarEnabled]" value="true" {% if user.isGravatarEnabled %}checked="checked"{% endif %}>
  99. <img src="https://gravatar.com/avatar/00000000000000000000000000000000?s=24" /> Gravatar
  100. <a href="https://gravatar.com/">
  101. <small><i class="fa fa-external-link" aria-hidden="true"></i></small>
  102. </a>
  103. </h4>
  104. </div>
  105. <img src="{{ user|gravatar }}" width="64">
  106. </div><!-- /.col-sm* -->
  107. <div class="form-group col-sm-8">
  108. <div class="radio">
  109. <h4>
  110. <input type="radio" form="formImageType" name="imagetypeForm[isGravatarEnabled]" value="false" {% if !user.isGravatarEnabled %}checked="checked"{% endif %}>
  111. {{ t('Upload Image') }}
  112. </h4>
  113. </div>
  114. <div class="form-group">
  115. <div id="pictureUploadFormMessage"></div>
  116. <label for="" class="col-sm-4 control-label">
  117. {{ t('Current Image') }}
  118. </label>
  119. <div class="col-sm-8">
  120. <p>
  121. <img src="{{ user|uploadedpicture }}" width="64" id="settingUserPicture"><br>
  122. </p>
  123. <p>
  124. {% if user.image %}
  125. <form action="/me/picture/delete" method="post" class="form-horizontal" role="form" onsubmit="return window.confirm('{{ t('Delete this image?') }}');">
  126. <button type="submit" class="btn btn-danger">{{ t('Delete Image') }}</button>
  127. </form>
  128. {% endif %}
  129. </p>
  130. </div>
  131. </div><!-- /.form-group -->
  132. <div class="form-group">
  133. <label for="" class="col-sm-4 control-label">
  134. {{ t('Upload new image') }}
  135. </label>
  136. <div class="col-sm-8">
  137. {% if isUploadable() %}
  138. <form action="/_api/me/picture/upload" id="pictureUploadForm" method="post" class="form-horizontal" role="form" enctype="multipart/form-data">
  139. <input name="userPicture" type="file" accept="image/*">
  140. <div id="pictureUploadFormProgress">
  141. </div>
  142. </form>
  143. {% else %}
  144. * {{ t('page_me.form_help.profile_image1') }}<br>
  145. * {{ t('page_me.form_help.profile_image2') }}<br>
  146. {% endif %}
  147. </div>
  148. </div><!-- /.form-group -->
  149. </div><!-- /.col-sm- -->
  150. <div class="form-group">
  151. <div class="col-sm-offset-4 col-sm-6">
  152. <button type="submit" form="formImageType" class="btn btn-primary">{{ t('Update') }}</button>
  153. </div>
  154. </div>
  155. </fieldset>
  156. </div><!-- /.form-box -->
  157. <script>
  158. $(function()
  159. {
  160. $("#pictureUploadForm input[name=userPicture]").on('change', function(){
  161. var $form = $('#pictureUploadForm');
  162. var fd = new FormData($form[0]);
  163. if ($(this).val() == '') {
  164. return false;
  165. }
  166. $('#pictureUploadFormProgress').html('<img src="/images/loading_s.gif"> アップロード中...');
  167. $.ajax($form.attr("action"), {
  168. type: 'post',
  169. processData: false,
  170. contentType: false,
  171. data: fd,
  172. dataType: 'json',
  173. success: function(data){
  174. if (data.status) {
  175. $('#settingUserPicture').attr('src', data.url + '?time=' + (new Date()));
  176. $('#pictureUploadFormMessage')
  177. .addClass('alert alert-success')
  178. .html('変更しました');
  179. } else {
  180. $('#pictureUploadFormMessage')
  181. .addClass('alert alert-danger')
  182. .html('変更中にエラーが発生しました。');
  183. }
  184. $('#pictureUploadFormProgress').html('');
  185. }
  186. });
  187. return false;
  188. });
  189. });
  190. </script>
  191. <div class="row">
  192. {% if googleLoginEnabled() %}
  193. <div class="col-sm-6"> {# Google Connect #}
  194. <div class="form-box">
  195. <form action="/me/auth/google" method="post" class="form-horizontal" role="form">
  196. <fieldset>
  197. <legend><i class="fa fa-google-plus-square"></i> {{ t('Google Setting') }}</legend>
  198. {% set wmessage = req.flash('warningMessage.auth.google') %}
  199. {% if wmessage.length %}
  200. <div class="alert alert-danger">
  201. {{ wmessage }}
  202. </div>
  203. {% endif %}
  204. <div class="form-group">
  205. {% if user.googleId %}
  206. <div class="col-sm-12">
  207. <p>
  208. {{ t('Connected') }}
  209. <input type="submit" name="disconnectGoogle" class="btn btn-default" value="{{ t('Disconnect') }}">
  210. </p>
  211. <p class="help-block">
  212. {{ t('page_me.form_help.google_disconnect1') }}<br>
  213. {{ t('page_me.form_help.google_disconnect2') }}
  214. </p>
  215. </div>
  216. {% else %}
  217. <div class="col-sm-12">
  218. <div class="text-center">
  219. <input type="submit" name="connectGoogle" class="btn btn-google" value="Googleコネクト">
  220. </div>
  221. <p class="help-block">
  222. {{ t('page_me.form_help.google_connect1') }}<br>
  223. </p>
  224. {% if config.crowi['security:registrationWhiteList'] && config.crowi['security:registrationWhiteList'].length %}
  225. <p class="help-block">
  226. {{ t('page_register.form_help.email') }}<br>
  227. {{ t('page_me.form_help.google_connect2') }}
  228. </p>
  229. <ul>
  230. {% for em in config.crowi['security:registrationWhiteList'] %}
  231. <li><code>{{ em }}</code></li>
  232. {% endfor %}
  233. </ul>
  234. {% endif %}
  235. </div>
  236. {% endif %}
  237. </div>
  238. </fieldset>
  239. </form>
  240. </div> {# /Google Connect #}
  241. {% endif %}
  242. </div>
  243. </div> {# end of .tab-contents #}
  244. {#
  245. <div class="form-box">
  246. <form action="/me/username" method="post" class="form-horizontal" role="form">
  247. <fieldset>
  248. <legend>ユーザーID (ユーザー名) の変更</legend>
  249. <div class="form-group">
  250. <label for="userNameForm[username]" class="col-sm-2 control-label">ユーザーID</label>
  251. <div class="col-sm-4">
  252. <input class="form-control" type="text" name="userNameForm[username]" value="{{ user.username }}" required>
  253. <p class="help-block">すべてのマイページの</p>
  254. </div>
  255. </div>
  256. <div class="form-group">
  257. <div class="col-sm-offset-2 col-sm-10">
  258. <p class="alert alert-warning">
  259. ユーザーIDを変更すると、<code>/user/{{ user.username }}</code> 以下のページがすべて <code>/user/新しいユーザーID</code> の下に移動されます。<br>
  260. また、これまでのページにリダイレクトは設定されず、この操作の取り消しもできません。<br>
  261. 実行には十分に注意をしてください。
  262. </p>
  263. <button type="submit" class="btn btn-warning">ユーザーIDの変更を実行する</button>
  264. </div>
  265. </div>
  266. </fieldset>
  267. </form>
  268. </div>
  269. #}
  270. </div>
  271. </div>
  272. {% endblock content_main %}
  273. {% block content_footer %}
  274. {% endblock content_footer %}
  275. {% block footer %}
  276. {% endblock footer %}