personal.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. <?php /**
  2. * Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com>
  3. * This file is licensed under the Affero General Public License version 3 or later.
  4. * See the COPYING-README file.
  5. */
  6. /** @var $_ mixed[]|\OCP\IURLGenerator[] */
  7. /** @var \OCP\Defaults $theme */
  8. ?>
  9. <div id="app-navigation">
  10. <ul class="with-icon">
  11. <?php foreach($_['forms'] as $form) {
  12. if (isset($form['anchor'])) {
  13. $anchor = '#' . $form['anchor'];
  14. $class = 'nav-icon-' . $form['anchor'];
  15. $sectionName = $form['section-name'];
  16. print_unescaped(sprintf("<li><a href='%s' class='%s'>%s</a></li>", \OCP\Util::sanitizeHTML($anchor),
  17. \OCP\Util::sanitizeHTML($class), \OCP\Util::sanitizeHTML($sectionName)));
  18. }
  19. }?>
  20. </ul>
  21. </div>
  22. <div id="app-content">
  23. <div id="quota" class="section">
  24. <div style="width:<?php p($_['usage_relative']);?>%"
  25. <?php if($_['usage_relative'] > 80): ?> class="quota-warning" <?php endif; ?>>
  26. <p id="quotatext">
  27. <?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?>
  28. <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>',
  29. [$_['usage'], $_['total_space']]));?>
  30. <?php else: ?>
  31. <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)',
  32. [$_['usage'], $_['total_space'], $_['usage_relative']]));?>
  33. <?php endif ?>
  34. </p>
  35. </div>
  36. </div>
  37. <div id="personal-settings">
  38. <div id="personal-settings-avatar-container">
  39. <form id="avatarform" class="section" method="post" action="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.postAvatar')); ?>">
  40. <h2>
  41. <label><?php p($l->t('Profile picture')); ?></label>
  42. <span class="icon-password"/>
  43. </h2>
  44. <div id="displayavatar">
  45. <div class="avatardiv"></div>
  46. <div class="warning hidden"></div>
  47. <?php if ($_['avatarChangeSupported']): ?>
  48. <label for="uploadavatar" class="inlineblock button icon-upload svg" id="uploadavatarbutton" title="<?php p($l->t('Upload new')); ?>"></label>
  49. <div class="inlineblock button icon-folder svg" id="selectavatar" title="<?php p($l->t('Select from Files')); ?>"></div>
  50. <div class="hidden button icon-delete svg" id="removeavatar" title="<?php p($l->t('Remove image')); ?>"></div>
  51. <input type="file" name="files[]" id="uploadavatar" class="hiddenuploadfield">
  52. <p><em><?php p($l->t('png or jpg, max. 20 MB')); ?></em></p>
  53. <?php else: ?>
  54. <?php p($l->t('Picture provided by original account')); ?>
  55. <?php endif; ?>
  56. </div>
  57. <div id="cropper" class="hidden">
  58. <div class="inner-container">
  59. <div class="inlineblock button" id="abortcropperbutton"><?php p($l->t('Cancel')); ?></div>
  60. <div class="inlineblock button primary" id="sendcropperbutton"><?php p($l->t('Choose as profile picture')); ?></div>
  61. </div>
  62. </div>
  63. <span class="icon-checkmark hidden"></span>
  64. <?php if($_['lookupServerUploadEnabled']) { ?>
  65. <input type="hidden" id="avatarscope" value="<?php p($_['avatarScope']) ?>">
  66. <?php } ?>
  67. </form>
  68. </div>
  69. <div id="personal-settings-container">
  70. <div class="personal-settings-setting-box">
  71. <form id="displaynameform" class="section">
  72. <h2>
  73. <label for="displayname"><?php p($l->t('Full name')); ?></label>
  74. <span class="icon-password"/>
  75. </h2>
  76. <input type="text" id="displayname" name="displayname"
  77. <?php if(!$_['displayNameChangeSupported']) { print_unescaped('disabled="1"'); } ?>
  78. value="<?php p($_['displayName']) ?>"
  79. autocomplete="on" autocapitalize="none" autocorrect="off" />
  80. <span class="icon-checkmark hidden" ></span>
  81. <span class="icon-error hidden" ></span>
  82. <?php if($_['lookupServerUploadEnabled']) { ?>
  83. <input type="hidden" id="displaynamescope" value="<?php p($_['displayNameScope']) ?>">
  84. <?php } ?>
  85. </form>
  86. </div>
  87. <div class="personal-settings-setting-box">
  88. <form id="emailform" class="section">
  89. <h2>
  90. <label for="email"><?php p($l->t('Email')); ?></label>
  91. <span class="icon-password"/>
  92. </h2>
  93. <div class="verify <?php if ($_['email'] === '' || $_['emailScope'] !== 'public') p('hidden'); ?>">
  94. <img id="verify-email" title="<?php p($_['emailMessage']); ?>" data-status="<?php p($_['emailVerification']) ?>" src="
  95. <?php
  96. switch($_['emailVerification']) {
  97. case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
  98. p(image_path('core', 'actions/verifying.svg'));
  99. break;
  100. case \OC\Accounts\AccountManager::VERIFIED:
  101. p(image_path('core', 'actions/verified.svg'));
  102. break;
  103. default:
  104. p(image_path('core', 'actions/verify.svg'));
  105. }
  106. ?>">
  107. </div>
  108. <input type="email" name="email" id="email" value="<?php if(!$_['displayNameChangeSupported'] && empty($_['email'])) p($l->t('No email address set')); else p($_['email']); ?>"
  109. <?php if(!$_['displayNameChangeSupported']) { print_unescaped('disabled="1"'); } ?>
  110. placeholder="<?php p($l->t('Your email address')) ?>"
  111. autocomplete="on" autocapitalize="none" autocorrect="off" />
  112. <?php if($_['displayNameChangeSupported']) { ?>
  113. <br />
  114. <em><?php p($l->t('For password reset and notifications')); ?></em>
  115. <?php } ?>
  116. <span class="icon-checkmark hidden"></span>
  117. <span class="icon-error hidden" ></span>
  118. <?php if($_['lookupServerUploadEnabled']) { ?>
  119. <input type="hidden" id="emailscope" value="<?php p($_['emailScope']) ?>">
  120. <?php } ?>
  121. </form>
  122. </div>
  123. <?php if (!empty($_['phone']) || $_['lookupServerUploadEnabled']) { ?>
  124. <div class="personal-settings-setting-box">
  125. <form id="phoneform" class="section">
  126. <h2>
  127. <label for="phone"><?php p($l->t('Phone number')); ?></label>
  128. <span class="icon-password"/>
  129. </h2>
  130. <input type="tel" id="phone" name="phone" <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?>
  131. value="<?php p($_['phone']) ?>"
  132. placeholder="<?php p($l->t('Your phone number')); ?>"
  133. autocomplete="on" autocapitalize="none" autocorrect="off" />
  134. <span class="icon-checkmark hidden"/>
  135. <?php if($_['lookupServerUploadEnabled']) { ?>
  136. <input type="hidden" id="phonescope" value="<?php p($_['phoneScope']) ?>">
  137. <?php } ?>
  138. </form>
  139. </div>
  140. <?php } ?>
  141. <?php if (!empty($_['address']) || $_['lookupServerUploadEnabled']) { ?>
  142. <div class="personal-settings-setting-box">
  143. <form id="addressform" class="section">
  144. <h2>
  145. <label for="address"><?php p($l->t('Address')); ?></label>
  146. <span class="icon-password"/>
  147. </h2>
  148. <input type="text" id="address" name="address" <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?>
  149. placeholder="<?php p($l->t('Your postal address')); ?>"
  150. value="<?php p($_['address']) ?>"
  151. autocomplete="on" autocapitalize="none" autocorrect="off" />
  152. <span class="icon-checkmark hidden"/>
  153. <?php if($_['lookupServerUploadEnabled']) { ?>
  154. <input type="hidden" id="addressscope" value="<?php p($_['addressScope']) ?>">
  155. <?php } ?>
  156. </form>
  157. </div>
  158. <?php } ?>
  159. <?php if (!empty($_['website']) || $_['lookupServerUploadEnabled']) { ?>
  160. <div class="personal-settings-setting-box">
  161. <form id="websiteform" class="section">
  162. <h2>
  163. <label for="website"><?php p($l->t('Website')); ?></label>
  164. <span class="icon-password"/>
  165. </h2>
  166. <?php if($_['lookupServerUploadEnabled']) { ?>
  167. <div class="verify <?php if ($_['website'] === '' || $_['websiteScope'] !== 'public') p('hidden'); ?>">
  168. <img id="verify-website" title="<?php p($_['websiteMessage']); ?>" data-status="<?php p($_['websiteVerification']) ?>" src="
  169. <?php
  170. switch($_['websiteVerification']) {
  171. case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
  172. p(image_path('core', 'actions/verifying.svg'));
  173. break;
  174. case \OC\Accounts\AccountManager::VERIFIED:
  175. p(image_path('core', 'actions/verified.svg'));
  176. break;
  177. default:
  178. p(image_path('core', 'actions/verify.svg'));
  179. }
  180. ?>"
  181. <?php if($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
  182. >
  183. <div class="verification-dialog popovermenu bubble menu">
  184. <div class="verification-dialog-content">
  185. <p class="explainVerification"></p>
  186. <p class="verificationCode"></p>
  187. <p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));?></p>
  188. </div>
  189. </div>
  190. </div>
  191. <?php } ?>
  192. <input type="text" name="website" id="website" value="<?php p($_['website']); ?>"
  193. placeholder="<?php p($l->t('Link https://…')); ?>"
  194. autocomplete="on" autocapitalize="none" autocorrect="off"
  195. <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?>
  196. />
  197. <span class="icon-checkmark hidden"/>
  198. <?php if($_['lookupServerUploadEnabled']) { ?>
  199. <input type="hidden" id="websitescope" value="<?php p($_['websiteScope']) ?>">
  200. <?php } ?>
  201. </form>
  202. </div>
  203. <?php } ?>
  204. <?php if (!empty($_['twitter']) || $_['lookupServerUploadEnabled']) { ?>
  205. <div class="personal-settings-setting-box">
  206. <form id="twitterform" class="section">
  207. <h2>
  208. <label for="twitter"><?php p($l->t('Twitter')); ?></label>
  209. <span class="icon-password"/>
  210. </h2>
  211. <?php if($_['lookupServerUploadEnabled']) { ?>
  212. <div class="verify <?php if ($_['twitter'] === '' || $_['twitterScope'] !== 'public') p('hidden'); ?>">
  213. <img id="verify-twitter" title="<?php p($_['twitterMessage']); ?>" data-status="<?php p($_['twitterVerification']) ?>" src="
  214. <?php
  215. switch($_['twitterVerification']) {
  216. case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
  217. p(image_path('core', 'actions/verifying.svg'));
  218. break;
  219. case \OC\Accounts\AccountManager::VERIFIED:
  220. p(image_path('core', 'actions/verified.svg'));
  221. break;
  222. default:
  223. p(image_path('core', 'actions/verify.svg'));
  224. }
  225. ?>"
  226. <?php if($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
  227. >
  228. <div class="verification-dialog popovermenu bubble menu">
  229. <div class="verification-dialog-content">
  230. <p class="explainVerification"></p>
  231. <p class="verificationCode"></p>
  232. <p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));?></p>
  233. </div>
  234. </div>
  235. </div>
  236. <?php } ?>
  237. <input type="text" name="twitter" id="twitter" value="<?php p($_['twitter']); ?>"
  238. placeholder="<?php p($l->t('Twitter handle @…')); ?>"
  239. autocomplete="on" autocapitalize="none" autocorrect="off"
  240. <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?>
  241. />
  242. <span class="icon-checkmark hidden"/>
  243. <?php if($_['lookupServerUploadEnabled']) { ?>
  244. <input type="hidden" id="twitterscope" value="<?php p($_['twitterScope']) ?>">
  245. <?php } ?>
  246. </form>
  247. </div>
  248. <?php } ?>
  249. <span class="msg"></span>
  250. </div>
  251. </div>
  252. <div class="clear"></div>
  253. <div id="groups" class="section">
  254. <h2><?php p($l->t('Groups')); ?></h2>
  255. <p><?php p($l->t('You are member of the following groups:')); ?></p>
  256. <p>
  257. <?php p(implode(', ', $_['groups'])); ?>
  258. </p>
  259. </div>
  260. <?php
  261. if($_['passwordChangeSupported']) {
  262. script('jquery-showpassword');
  263. ?>
  264. <form id="passwordform" class="section">
  265. <h2 class="inlineblock"><?php p($l->t('Password'));?></h2>
  266. <div id="password-error-msg" class="msg success inlineblock" style="display: none;">Saved</div>
  267. <br>
  268. <label for="pass1" class="hidden-visually"><?php p($l->t('Current password')); ?>: </label>
  269. <input type="password" id="pass1" name="oldpassword"
  270. placeholder="<?php p($l->t('Current password'));?>"
  271. autocomplete="off" autocapitalize="none" autocorrect="off" />
  272. <div class="personal-show-container">
  273. <label for="pass2" class="hidden-visually"><?php p($l->t('New password'));?>: </label>
  274. <input type="password" id="pass2" name="newpassword"
  275. placeholder="<?php p($l->t('New password')); ?>"
  276. data-typetoggle="#personal-show"
  277. autocomplete="off" autocapitalize="none" autocorrect="off" />
  278. <input type="checkbox" id="personal-show" name="show" /><label for="personal-show" class="personal-show-label"></label>
  279. </div>
  280. <input id="passwordbutton" type="submit" value="<?php p($l->t('Change password')); ?>" />
  281. <br/>
  282. </form>
  283. <?php
  284. }
  285. ?>
  286. <?php if (isset($_['activelanguage'])) { ?>
  287. <form id="language" class="section">
  288. <h2>
  289. <label for="languageinput"><?php p($l->t('Language'));?></label>
  290. </h2>
  291. <select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language'));?>">
  292. <option value="<?php p($_['activelanguage']['code']);?>">
  293. <?php p($_['activelanguage']['name']);?>
  294. </option>
  295. <?php foreach($_['commonlanguages'] as $language):?>
  296. <option value="<?php p($language['code']);?>">
  297. <?php p($language['name']);?>
  298. </option>
  299. <?php endforeach;?>
  300. <optgroup label="––––––––––"></optgroup>
  301. <?php foreach($_['languages'] as $language):?>
  302. <option value="<?php p($language['code']);?>">
  303. <?php p($language['name']);?>
  304. </option>
  305. <?php endforeach;?>
  306. </select>
  307. <a href="https://www.transifex.com/nextcloud/nextcloud/"
  308. target="_blank" rel="noreferrer">
  309. <em><?php p($l->t('Help translate'));?></em>
  310. </a>
  311. </form>
  312. <?php } ?>
  313. <?php if(OC_APP::isEnabled('firstrunwizard')) {?>
  314. <div id="clientsbox" class="section clientsbox">
  315. <h2><?php p($l->t('Get the apps to sync your files'));?></h2>
  316. <a href="<?php p($_['clients']['desktop']); ?>" rel="noreferrer" target="_blank">
  317. <img src="<?php print_unescaped(image_path('core', 'desktopapp.svg')); ?>"
  318. alt="<?php p($l->t('Desktop client'));?>" />
  319. </a>
  320. <a href="<?php p($_['clients']['android']); ?>" rel="noreferrer" target="_blank">
  321. <img src="<?php print_unescaped(image_path('core', 'googleplay.png')); ?>"
  322. alt="<?php p($l->t('Android app'));?>" />
  323. </a>
  324. <a href="<?php p($_['clients']['ios']); ?>" rel="noreferrer" target="_blank">
  325. <img src="<?php print_unescaped(image_path('core', 'appstore.svg')); ?>"
  326. alt="<?php p($l->t('iOS app'));?>" />
  327. </a>
  328. <p>
  329. <?php print_unescaped(str_replace(
  330. [
  331. '{contributeopen}',
  332. '{linkclose}',
  333. ],
  334. [
  335. '<a href="https://nextcloud.com/contribute" target="_blank" rel="noreferrer">',
  336. '</a>',
  337. ],
  338. $l->t('If you want to support the project {contributeopen}join development{linkclose} or {contributeopen}spread the word{linkclose}!'))); ?>
  339. </p>
  340. <p><a class="button" href="#" id="showWizard"><?php p($l->t('Show First Run Wizard again'));?></a></p>
  341. </div>
  342. <?php }?>
  343. <div id="security" class="section">
  344. <h2><?php p($l->t('Security'));?></h2>
  345. <p class="settings-hint hidden-when-empty"><?php p($l->t('Web, desktop, mobile clients and app specific passwords that currently have access to your account.'));?></p>
  346. <table class="icon-loading">
  347. <thead class="token-list-header">
  348. <tr>
  349. <th><?php p($l->t('Device'));?></th>
  350. <th><?php p($l->t('Last activity'));?></th>
  351. <th></th>
  352. </tr>
  353. </thead>
  354. <tbody class="token-list">
  355. </tbody>
  356. </table>
  357. <h3><?php p($l->t('App passwords'));?></h3>
  358. <p class="settings-hint"><?php p($l->t('Here you can generate individual passwords for apps so you don’t have to give out your password. You can revoke them individually too.'));?></p>
  359. <div id="app-password-form">
  360. <input id="app-password-name" type="text" placeholder="<?php p($l->t('App name')); ?>">
  361. <button id="add-app-password" class="button"><?php p($l->t('Create new app password')); ?></button>
  362. </div>
  363. <div id="app-password-result" class="hidden">
  364. <span>
  365. <?php p($l->t('Use the credentials below to configure your app or device.')); ?>
  366. <?php p($l->t('For security reasons this password will only be shown once.')); ?>
  367. </span>
  368. <div class="app-password-row">
  369. <span class="app-password-label"><?php p($l->t('Username')); ?></span>
  370. <input id="new-app-login-name" type="text" readonly="readonly"/>
  371. </div>
  372. <div class="app-password-row">
  373. <span class="app-password-label"><?php p($l->t('Password')); ?></span>
  374. <input id="new-app-password" type="text" readonly="readonly"/>
  375. <a class="clipboardButton icon icon-clippy" data-clipboard-target="#new-app-password"></a>
  376. <button id="app-password-hide" class="button"><?php p($l->t('Done')); ?></button>
  377. </div>
  378. </div>
  379. </div>
  380. <?php foreach($_['forms'] as $form) {
  381. if (isset($form['form'])) {?>
  382. <div id="<?php isset($form['anchor']) ? p($form['anchor']) : p('');?>"><?php print_unescaped($form['form']);?></div>
  383. <?php }
  384. };?>
  385. <div class="section">
  386. <h2><?php p($l->t('Version'));?></h2>
  387. <p><a href="<?php print_unescaped($theme->getBaseUrl()); ?>" target="_blank"><?php p($theme->getTitle()); ?></a> <?php p(OC_Util::getHumanVersion()) ?></p>
  388. <p><?php include('settings.development.notice.php'); ?></p>
  389. </div>
  390. </div>