index.html 9.6 KB

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