index.html 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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/password"><i class="fa fa-key"></i> {{ t('Password Settings') }}</a></li>
  15. <li><a href="/me/apiToken"><i class="fa fa-rocket"></i> {{ t('API Settings') }}</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('Basic Info') }}</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. {% if config.crowi['security:registrationWhiteList'] && config.crowi['security:registrationWhiteList'].length %}
  56. <p class="help-block">
  57. {{ t('page_register.form_help.email') }}
  58. <ul>
  59. {% for em in config.crowi['security:registrationWhiteList'] %}
  60. <li><code>{{ em }}</code></li>
  61. {% endfor %}
  62. </ul>
  63. </p>
  64. {% endif %}
  65. </div>
  66. </div>
  67. <div class="form-group {% if not user.lang %}has-error{% endif %}">
  68. <label for="userForm[lang]" class="col-sm-2 control-label">{{ t('Language') }}</label>
  69. <div class="col-sm-4">
  70. <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>
  71. <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>
  72. </div>
  73. </div>
  74. <div class="form-group">
  75. <div class="col-sm-offset-2 col-sm-10">
  76. <button type="submit" class="btn btn-primary">{{ t('Update') }}</button>
  77. </div>
  78. </div>
  79. </fieldset>
  80. </form>
  81. </div>
  82. <div class="form-box">
  83. <fieldset>
  84. <legend>{{ t('Set Profile Image') }}</legend>
  85. <div class="form-group">
  86. <div id="pictureUploadFormMessage"></div>
  87. <label for="" class="col-sm-3 control-label">
  88. {{ t('Current Image') }}
  89. </label>
  90. <div class="col-sm-9">
  91. <p>
  92. <img src="{{ user|picture }}" width="64" id="settingUserPicture"><br>
  93. </p>
  94. <p>
  95. {% if user.image %}
  96. <form action="/me/picture/delete" method="post" class="form-horizontal" role="form" onsubmit="return window.confirm('{{ t('Delete this image?') }}');">
  97. <button type="submit" class="btn btn-danger">{{ t('Delete Image') }}</button>
  98. </form>
  99. {% endif %}
  100. </p>
  101. </div>
  102. </div> {# /.form-group# #}
  103. <div class="form-group">
  104. <label for="" class="col-sm-3 control-label">
  105. {{ t('Upload new image') }}
  106. </label>
  107. <div class="col-sm-9">
  108. {% if isUploadable() %}
  109. <form action="/_api/me/picture/upload" id="pictureUploadForm" method="post" class="form-horizontal" role="form" enctype="multipart/form-data">
  110. <input name="userPicture" type="file" accept="image/*">
  111. <div id="pictureUploadFormProgress">
  112. </div>
  113. </form>
  114. {% else %}
  115. * {{ t('page_me.form_help.profile_image1') }}<br>
  116. * {{ t('page_me.form_help.profile_image2') }}<br>
  117. {% endif %}
  118. </div>
  119. </div>
  120. </fieldset>
  121. </div>
  122. <script>
  123. $(function()
  124. {
  125. $("#pictureUploadForm input[name=userPicture]").on('change', function(){
  126. var $form = $('#pictureUploadForm');
  127. var fd = new FormData($form[0]);
  128. if ($(this).val() == '') {
  129. return false;
  130. }
  131. $('#pictureUploadFormProgress').html('<img src="/images/loading_s.gif"> アップロード中...');
  132. $.ajax($form.attr("action"), {
  133. type: 'post',
  134. processData: false,
  135. contentType: false,
  136. data: fd,
  137. dataType: 'json',
  138. success: function(data){
  139. if (data.status) {
  140. $('#settingUserPicture').attr('src', data.url + '?time=' + (new Date()));
  141. $('#pictureUploadFormMessage')
  142. .addClass('alert alert-success')
  143. .html('変更しました');
  144. } else {
  145. $('#pictureUploadFormMessage')
  146. .addClass('alert alert-danger')
  147. .html('変更中にエラーが発生しました。');
  148. }
  149. $('#pictureUploadFormProgress').html('');
  150. }
  151. });
  152. return false;
  153. });
  154. });
  155. </script>
  156. <div class="row">
  157. {% if googleLoginEnabled() %}
  158. <div class="col-sm-6"> {# Google Connect #}
  159. <div class="form-box">
  160. <form action="/me/auth/google" method="post" class="form-horizontal" role="form">
  161. <fieldset>
  162. <legend><i class="fa fa-google-plus-square"></i> {{ t('Google Setting') }}</legend>
  163. {% set wmessage = req.flash('warningMessage.auth.google') %}
  164. {% if wmessage.length %}
  165. <div class="alert alert-danger">
  166. {{ wmessage }}
  167. </div>
  168. {% endif %}
  169. <div class="form-group">
  170. {% if user.googleId %}
  171. <div class="col-sm-12">
  172. <p>
  173. {{ t('Connected') }}
  174. <input type="submit" name="disconnectGoogle" class="btn btn-default" value="{{ t('Disconnect') }}">
  175. </p>
  176. <p class="help-block">
  177. {{ t('page_me.form_help.google_disconnect1') }}<br>
  178. {{ t('page_me.form_help.google_disconnect2') }}
  179. </p>
  180. </div>
  181. {% else %}
  182. <div class="col-sm-12">
  183. <div class="text-center">
  184. <input type="submit" name="connectGoogle" class="btn btn-google" value="Googleコネクト">
  185. </div>
  186. <p class="help-block">
  187. {{ t('page_me.form_help.google_connect1') }}<br>
  188. </p>
  189. {% if config.crowi['security:registrationWhiteList'] && config.crowi['security:registrationWhiteList'].length %}
  190. <p class="help-block">
  191. {{ t('page_register.form_help.email') }}<br>
  192. {{ t('page_me.form_help.google_connect2') }}
  193. </p>
  194. <ul>
  195. {% for em in config.crowi['security:registrationWhiteList'] %}
  196. <li><code>{{ em }}</code></li>
  197. {% endfor %}
  198. </ul>
  199. {% endif %}
  200. </div>
  201. {% endif %}
  202. </div>
  203. </fieldset>
  204. </form>
  205. </div> {# /Google Connect #}
  206. {% endif %}
  207. </div>
  208. </div> {# end of .tab-contents #}
  209. {#
  210. <div class="form-box">
  211. <form action="/me/username" method="post" class="form-horizontal" role="form">
  212. <fieldset>
  213. <legend>ユーザーID (ユーザー名) の変更</legend>
  214. <div class="form-group">
  215. <label for="userNameForm[username]" class="col-sm-2 control-label">ユーザーID</label>
  216. <div class="col-sm-4">
  217. <input class="form-control" type="text" name="userNameForm[username]" value="{{ user.username }}" required>
  218. <p class="help-block">すべてのマイページの</p>
  219. </div>
  220. </div>
  221. <div class="form-group">
  222. <div class="col-sm-offset-2 col-sm-10">
  223. <p class="alert alert-warning">
  224. ユーザーIDを変更すると、<code>/user/{{ user.username }}</code> 以下のページがすべて <code>/user/新しいユーザーID</code> の下に移動されます。<br>
  225. また、これまでのページにリダイレクトは設定されず、この操作の取り消しもできません。<br>
  226. 実行には十分に注意をしてください。
  227. </p>
  228. <button type="submit" class="btn btn-warning">ユーザーIDの変更を実行する</button>
  229. </div>
  230. </div>
  231. </fieldset>
  232. </form>
  233. </div>
  234. #}
  235. </div>
  236. </div>
  237. {% endblock content_main %}
  238. {% block content_footer %}
  239. {% endblock content_footer %}
  240. {% block footer %}
  241. {% endblock footer %}