Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Solved Discourse change root email error

    Discourse
    discourse error
    2
    3
    104
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      LoudLemur last edited by nebulon

      SyntaxError ((irb):2: syntax error, unexpected ':', expecting `end')
      irb(main):001:0> u = User.find_by_usern...
               ^
      

      The Cloudron instructions to change root's email are here;

      https://docs.cloudron.io/apps/discourse/

      subven 1 Reply Last reply Reply Quote 0
      • subven
        subven @LoudLemur last edited by subven

        @LoudLemur works like expected. Please do not copy the whole line and not everything all at once.

        root@24b1add9-15ef-4255-9c41-818b8ab7b3dc:/app/code# sudo -E -u root bundle exec script/rails console
        fatal: not a git repository (or any of the parent directories): .git
        Loading production environment (Rails 6.1.6.1)
        irb(main):001:0> u = User.find_by_username("root")
        => #<User id: 1, username: "root", created_at: "2022-08-30 21:45:35.005212000 +0000", updated_at: "2022...
        irb(main):002:0> u.email = "admin@test.pro"
        => "admin@test.pro"
        irb(main):003:0> u.email_tokens.create(email: u.email)
        => #<EmailToken id: 6, user_id: 1, email: "admin@test.pro", confirmed: false, expired: false, created_at: "2022-08-30 21:48:23.999384866 +0000", updated_at: "2022-08-30 21:48:23.999384866 +0000", token_hash: "16536bc4c1bc61d44853bcdc8bb5dbe18833341fe1612d74bd...", scope: nil>
        irb(main):004:0> u.save!
        => true
        irb(main):005:0>
        

        First you enter the console and afterwards you paste the commands line by line starting with u = User.find_by_username("root")...

        L 1 Reply Last reply Reply Quote 2
        • subven
          subven @LoudLemur last edited by subven

          @LoudLemur works like expected. Please do not copy the whole line and not everything all at once.

          root@24b1add9-15ef-4255-9c41-818b8ab7b3dc:/app/code# sudo -E -u root bundle exec script/rails console
          fatal: not a git repository (or any of the parent directories): .git
          Loading production environment (Rails 6.1.6.1)
          irb(main):001:0> u = User.find_by_username("root")
          => #<User id: 1, username: "root", created_at: "2022-08-30 21:45:35.005212000 +0000", updated_at: "2022...
          irb(main):002:0> u.email = "admin@test.pro"
          => "admin@test.pro"
          irb(main):003:0> u.email_tokens.create(email: u.email)
          => #<EmailToken id: 6, user_id: 1, email: "admin@test.pro", confirmed: false, expired: false, created_at: "2022-08-30 21:48:23.999384866 +0000", updated_at: "2022-08-30 21:48:23.999384866 +0000", token_hash: "16536bc4c1bc61d44853bcdc8bb5dbe18833341fe1612d74bd...", scope: nil>
          irb(main):004:0> u.save!
          => true
          irb(main):005:0>
          

          First you enter the console and afterwards you paste the commands line by line starting with u = User.find_by_username("root")...

          L 1 Reply Last reply Reply Quote 2
          • Topic is now a regular thread  L LoudLemur 
          • L
            LoudLemur @subven last edited by

            @subven Thank you! I tried again

            1 Reply Last reply Reply Quote 0
            • Topic has been marked as a question  nebulon nebulon 
            • Topic has been marked as solved  nebulon nebulon 
            • Topic has been marked as unsolved  girish girish 
            • Topic has been marked as solved  girish girish 
            • First post
              Last post
            Powered by NodeBB