index.html 12 KB

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