How to restrict my "library" page to logged in users

I want my users to gain access to my library page after logging in. Do I need to authenticate user first? And how? Then what command to use in the redirect file?

<!--- My form --> 

<div class="container">
<div class="card">
    <div class="inner-box" id="card">
        <div class="flip-card-front">
            <h2>LOGIN</h2>
            <form name="user" method="POST" data-netlify-recaptcha="true" netlify-honeypot="bot-field" data-netlify="true">
                <input type="email" class="input-box" placeholder="Your Email Id" required>
                <input type="password" class="input-box" placeholder="Password" required>
                <button type="submit" class="submit-btn">Submit</button>
                <input type="checkbox"><span>Remember Me</span>
                </form>
                <button type="button" class="btn" onclick="openRegister()">I'm New Here</button>
                <a href="">Forgot Password</a>
            </div>
        <div class="flip-card-back">
            <h2>REGISTER</h2>
            <form name="user" method="POST" data-netlify-recaptcha="true" netlify-honeypot="bot-field" data-netlify="true">
                <input type="text" class="input-box" placeholder="Your Name" required>
                <input type="email" class="input-box" placeholder="Your Email Id" required>
                <input type="password" class="input-box" placeholder="Password" required>
                <button type="submit" class="submit-btn">Submit</button>
                <input type="checkbox"><span>Remember Me</span>
                </form>
<!-- My redirect file -->
/library 301! Role=user

You could use Netify Identity

1 Like