index.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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 Infomation') }}</a></li>
  14. <li><a href="/me/password"><i class="fa fa-key"></i> {{ t('Password Setting') }}</a></li>
  15. <li><a href="/me/apiToken"><i class="fa fa-rocket"></i> {{ t('API Setting') }}</a></li>
  16. </ul>
  17. <div class="tab-content">
  18. {% set smessage = req.flash('successMessage') %}
  19. {% if smessage.length %}
  20. <div class="alert alert-success">
  21. {{ smessage }}
  22. </div>
  23. {% endif %}
  24. {% set wmessage = req.flash('warningMessage') %}
  25. {% if wmessage.length %}
  26. <div class="alert alert-danger">
  27. {{ wmessage }}
  28. </div>
  29. {% endif %}
  30. {% if req.form.errors.length > 0 %}
  31. <div class="alert alert-danger">
  32. <ul>
  33. {% for error in req.form.errors %}
  34. <li>{{ error }}</li>
  35. {% endfor %}
  36. </ul>
  37. </div>
  38. {% endif %}
  39. <div class="form-box">
  40. <form action="/me" method="post" class="form-horizontal" role="form">
  41. <fieldset>
  42. <legend>{{ t('User Basic Infomation') }}</legend>
  43. <div class="form-group">
  44. <label for="userForm[name]" class="col-sm-2 control-label">{{ t('Name') }}</label>
  45. <div class="col-sm-4">
  46. <input class="form-control" type="text" name="userForm[name]" value="{{ user.name }}" required>
  47. </div>
  48. </div>
  49. <div class="form-group {% if not user.email %}has-error{% endif %}">
  50. <label for="userForm[email]" class="col-sm-2 control-label">{{ t('Email') }}</label>
  51. <div class="col-sm-4">
  52. <input class="form-control" type="email" name="userForm[email]" value="{{ user.email }}" required>
  53. </div>
  54. <div class="col-sm-offset-2 col-sm-10">
  55. {# ↓ そのうちこのコードは削除する #}
  56. {% if not user.email %}
  57. <p class="help-block help-danger">
  58. メールアドレスは登録必須項目です。<br>
  59. (以前のバージョンのWikiで作成されたユーザー情報の場合、メールアドレスが登録されていません)<br>
  60. 更新ボタンを押して新規登録してください。
  61. </p>
  62. {% endif %}
  63. {% if config.crowi['security:registrationWhiteList'] && config.crowi['security:registrationWhiteList'].length %}
  64. <p class="help-block">
  65. {{ t('In this wiki, only the following e-mail address can be registered.') }}
  66. <ul>
  67. {% for em in config.crowi['security:registrationWhiteList'] %}
  68. <li><code>{{ em }}</code></li>
  69. {% endfor %}
  70. </ul>
  71. </p>
  72. {% endif %}
  73. </div>
  74. <div class="form-group {% if not user.lang %}has-error{% endif %}">
  75. <label for="userForm[lang]" class="col-sm-2 control-label">{{ t('lang') }}</label>
  76. <div class="col-sm-4 radio">
  77. <label><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>
  78. <label><input type="radio" name="userForm[lang]" value="{{ consts.language.LANG_JA_JP }}" {% if user.lang == consts.language.LANG_JA_JP %}checked="checked"{% endif %}>{{ t('Japanese') }}</label>
  79. </div>
  80. <div class="col-sm-offset-2 col-sm-10">
  81. </div>
  82. </div>
  83. </div>
  84. <div class="form-group">
  85. <div class="col-sm-offset-2 col-sm-10">
  86. <button type="submit" class="btn btn-primary">{{ t('Update') }}</button>
  87. </div>
  88. </div>
  89. </fieldset>
  90. </form>
  91. </div>
  92. <div class="form-box">
  93. <fieldset>
  94. <legend>{{ t('Profile Image Setting') }}</legend>
  95. <div class="form-group">
  96. <div id="pictureUploadFormMessage"></div>
  97. <label for="" class="col-sm-3 control-label">
  98. {{ t('Current Image') }}
  99. </label>
  100. <div class="col-sm-9">
  101. <p>
  102. <img src="{{ user|picture }}" width="64" id="settingUserPicture"><br>
  103. </p>
  104. <p>
  105. {% if user.image %}
  106. <form action="/me/picture/delete" method="post" class="form-horizontal" role="form" onsubmit="return window.confirm('{{ t('Are you sure to delete?') }}');">
  107. <button type="submit" class="btn btn-danger">{{ t('Delete Image') }}</button>
  108. </form>
  109. {% endif %}
  110. </p>
  111. </div>
  112. </div> {# /.form-group# #}
  113. <div class="form-group">
  114. <label for="" class="col-sm-3 control-label">
  115. {{ t('Upload new image') }}
  116. </label>
  117. <div class="col-sm-9">
  118. {% if isUploadable() %}
  119. <form action="/_api/me/picture/upload" id="pictureUploadForm" method="post" class="form-horizontal" role="form" enctype="multipart/form-data">
  120. <input name="userPicture" type="file" accept="image/*">
  121. <div id="pictureUploadFormProgress">
  122. </div>
  123. </form>
  124. {% else %}
  125. * 画像をアップロードをするための設定がされていません。<br>
  126. * アップロードできるようにするには、AWS またはローカルアップロードの設定をしてください。<br>
  127. {% endif %}
  128. </div>
  129. </div>
  130. </fieldset>
  131. </div>
  132. <script>
  133. $(function()
  134. {
  135. $("#pictureUploadForm input[name=userPicture]").on('change', function(){
  136. var $form = $('#pictureUploadForm');
  137. var fd = new FormData($form[0]);
  138. if ($(this).val() == '') {
  139. return false;
  140. }
  141. $('#pictureUploadFormProgress').html('<img src="/images/loading_s.gif"> アップロード中...');
  142. $.ajax($form.attr("action"), {
  143. type: 'post',
  144. processData: false,
  145. contentType: false,
  146. data: fd,
  147. dataType: 'json',
  148. success: function(data){
  149. if (data.status) {
  150. $('#settingUserPicture').attr('src', data.url + '?time=' + (new Date()));
  151. $('#pictureUploadFormMessage')
  152. .addClass('alert alert-success')
  153. .html('変更しました');
  154. } else {
  155. $('#pictureUploadFormMessage')
  156. .addClass('alert alert-danger')
  157. .html('変更中にエラーが発生しました。');
  158. }
  159. $('#pictureUploadFormProgress').html('');
  160. }
  161. });
  162. return false;
  163. });
  164. });
  165. </script>
  166. <div class="row">
  167. {% if googleLoginEnabled() %}
  168. <div class="col-sm-6"> {# Google Connect #}
  169. <div class="form-box">
  170. <form action="/me/auth/google" method="post" class="form-horizontal" role="form">
  171. <fieldset>
  172. <legend><i class="fa fa-google-plus-square"></i> {{ t('Google Setting') }}</legend>
  173. {% set wmessage = req.flash('warningMessage.auth.google') %}
  174. {% if wmessage.length %}
  175. <div class="alert alert-danger">
  176. {{ wmessage }}
  177. </div>
  178. {% endif %}
  179. <div class="form-group">
  180. {% if user.googleId %}
  181. <div class="col-sm-12">
  182. <p>
  183. {{ t('Connected') }}
  184. <input type="submit" name="disconnectGoogle" class="btn btn-default" value="{{ t('Disconnect') }}">
  185. </p>
  186. <p class="help-block">
  187. {{ t('If disconnet Google, you can not login by Google Authentication.') }}<br>
  188. {{ t('After disconnect, you can login using email and password.') }}
  189. </p>
  190. </div>
  191. {% else %}
  192. <div class="col-sm-12">
  193. <div class="text-center">
  194. <input type="submit" name="connectGoogle" class="btn btn-google" value="Googleコネクト">
  195. </div>
  196. <p class="help-block">
  197. {{ t('With Google Connect, you can sign in with your Google Account.') }}<br>
  198. </p>
  199. {% if config.crowi['security:registrationWhiteList'] && config.crowi['security:registrationWhiteList'].length %}
  200. <p class="help-block">
  201. {{ t('In this wiki, the registrable mail address is limited.') }}
  202. {{ t('Only Google Apps accounts with the following email addresses are connectable Google accounts:') }}
  203. </p>
  204. <ul>
  205. {% for em in config.crowi['security:registrationWhiteList'] %}
  206. <li><code>{{ em }}</code></li>
  207. {% endfor %}
  208. </ul>
  209. {% endif %}
  210. </div>
  211. {% endif %}
  212. </div>
  213. </fieldset>
  214. </form>
  215. </div> {# /Google Connect #}
  216. {% endif %}
  217. </div>
  218. </div> {# end of .tab-contents #}
  219. {#
  220. <div class="form-box">
  221. <form action="/me/username" method="post" class="form-horizontal" role="form">
  222. <fieldset>
  223. <legend>ユーザーID (ユーザー名) の変更</legend>
  224. <div class="form-group">
  225. <label for="userNameForm[username]" class="col-sm-2 control-label">ユーザーID</label>
  226. <div class="col-sm-4">
  227. <input class="form-control" type="text" name="userNameForm[username]" value="{{ user.username }}" required>
  228. <p class="help-block">すべてのマイページの</p>
  229. </div>
  230. </div>
  231. <div class="form-group">
  232. <div class="col-sm-offset-2 col-sm-10">
  233. <p class="alert alert-warning">
  234. ユーザーIDを変更すると、<code>/user/{{ user.username }}</code> 以下のページがすべて <code>/user/新しいユーザーID</code> の下に移動されます。<br>
  235. また、これまでのページにリダイレクトは設定されず、この操作の取り消しもできません。<br>
  236. 実行には十分に注意をしてください。
  237. </p>
  238. <button type="submit" class="btn btn-warning">ユーザーIDの変更を実行する</button>
  239. </div>
  240. </div>
  241. </fieldset>
  242. </form>
  243. </div>
  244. #}
  245. </div>
  246. </div>
  247. {% endblock content_main %}
  248. {% block content_footer %}
  249. {% endblock content_footer %}
  250. {% block footer %}
  251. {% endblock footer %}