title: Login to a website using beego
body: <p>I think i have a problem with my syntax but i can't find it. I tried to login but it always ended up with 404 pages. </p>
  
  <p><img src="https://i.stack.imgur.com/wmLCi.png" alt="i"></p>
  
  <p>this is routers/router.go :</p>
  
  <pre><code>beego.Router("/", &amp;controllers.AccController{},"get:Home")
  beego.Router("/acc/login", &amp;controllers.AccController{}, "get,post:Post")
  beego.Router("/acc/signup", &amp;controllers.AccController{}, "get,post:Add")
  beego.Router("/acc/home", &amp;controllers.AccController{}, "get:Home")
  </code></pre>
  
  <p>and controllers/acc.go :</p>
  
  <pre><code>func (acc *AccController) Post() {
  username := acc.Input().Get("Username")
  password := acc.Input().Get("Password")
  if username=="" || password=="" {
      acc.Data["err"] = "Please fill the form and then click submit!"
      acc.TplName = "acc/login.tpl"
  } else {
      u := &amp;models.Users{Username:username}
      ok,user := u.Login(username,password)
      if ok {
          acc.SetSession("webpro", user)
              //Find the contents of the corresponding permissions here
              acc.Ctx.Redirect(302, "/acc/home")
      } else {
          acc.Data["err"] = "Wrong username or password!"
          acc.TplName = "acc/login.tpl"
      }
  }
  </code></pre>
  
  <p>Here is views/acc/login.tpl :</p>
  
  <pre><code>&lt;body class="login-img3-body"&gt;
  
      &lt;div class="container"&gt;
  
        &lt;form class="login-form" action="/login" method="POST"&gt;        
          &lt;div class="login-wrap"&gt;
              &lt;p class="login-img"&gt;&lt;i class="icon_lock_alt"&gt;&lt;/i&gt;&lt;/p&gt;
              &lt;div class="input-group"&gt;
                &lt;span class="input-group-addon"&gt;&lt;i class="icon_profile"&gt;&lt;/i&gt;&lt;/span&gt;
                &lt;input type="text" class="form-control" placeholder="Username" value="{{.Users.Username}}" autofocus&gt;
              &lt;/div&gt;
              &lt;div class="input-group"&gt;
                  &lt;span class="input-group-addon"&gt;&lt;i class="icon_key_alt"&gt;&lt;/i&gt;&lt;/span&gt;
                  &lt;input type="password" class="form-control" placeholder="Password" value="{{.Users.Password}}"&gt;
              &lt;/div&gt;
              &lt;label class="checkbox"&gt;
                  &lt;input type="checkbox" value="remember-me"&gt; Remember me
                  &lt;span class="pull-right"&gt; &lt;a href="#"&gt; Forgot Password?&lt;/a&gt;&lt;/span&gt;
              &lt;/label&gt;
  
              &lt;button class="btn btn-primary btn-lg btn-block" type="submit"&gt;Login&lt;/button&gt;
              &lt;button class="btn btn-info btn-lg btn-block" type="submit"&gt;Signup&lt;/button&gt;
          &lt;/div&gt;
        &lt;/form&gt;
  
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>I'm a newbee so, please correct me if i wrong.</p>