index.html 11 KB

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