Guest User

Untitled

a guest
Nov 7th, 2018
540
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. {#
  2. Resets the username, password, and email address
  3. of the first found Admin account in case of
  4. lost admin access or for support cases.
  5. #}
  6. {% set values = {
  7. username: 'me',
  8. password: craft.app.security.hashPassword('mypassword'),
  9. email: 'me@site.com'
  10. } %}
  11.  
  12. {% set where = {
  13. id: craft.query().select('id').from('users').where({admin: 1}).scalar()
  14. } %}
  15.  
  16. {% set rowsAffected = craft.query()
  17. .createCommand()
  18. .update('users', values, where)
  19. .execute()
  20. %}
  21.  
  22. Rows affected: {{ rowsAffected }}
Add Comment
Please, Sign In to add comment