GithubHelp home page GithubHelp logo

Comments (5)

nomicflux avatar nomicflux commented on August 25, 2024 1

Aha - the problem was that my username had a space in it, and the hashing code in lib/data/user.ex requires a valid changeset:

  defp hash_password(changeset) do
    case changeset do
      %{valid?: true, changes: %{password: password}} ->
        put_change(changeset, :password_hash, Comeonin.Bcrypt.hashpwsalt(password))

      _ ->
        changeset
    end
  end

Verified that changing the username to a valid one removes the password error.

from ex_venture.

nomicflux avatar nomicflux commented on August 25, 2024

This appears to be related to hashing; changing the line

        <%= error_tag f, :password_hash %>

to

        <%= error_tag f, :password %>

in web/templates/registration/new.html.eex allows the account to be created after fixing other validation errors.

from ex_venture.

oestrich avatar oestrich commented on August 25, 2024

Hmm, I was able to make an account locally without issue. Did your passwords match? It might be that along with what you just found. I was able to get the proper warnings with a miss-match.

from ex_venture.

nomicflux avatar nomicflux commented on August 25, 2024

Any ideas on the best way of going about improving this? The error message is misleading, but there isn't much sense in hashing the password until creating the user, either. Should the template just show errors for :password under that field, and throw more serious errors about a server-side problem if :password_hash is problematic?

from ex_venture.

oestrich avatar oestrich commented on August 25, 2024

Yeah I'm not sure. Might be worth switching the password field to using error_tag(f, :password). Might be some other small tweaks that need to happen but this is a good start.

from ex_venture.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.